<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Tutorials Code Snippets and Php Tips &#187; php tutorial</title>
	<atom:link href="http://readytousesolutions.com/phpblog/tag/php-tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://readytousesolutions.com/phpblog</link>
	<description>PHP tutorials - Examples of the most useful scripts</description>
	<lastBuildDate>Thu, 23 Sep 2010 06:54:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP Tutorial : Random link rotator</title>
		<link>http://readytousesolutions.com/phpblog/php-tutorial-random-link-rotator/</link>
		<comments>http://readytousesolutions.com/phpblog/php-tutorial-random-link-rotator/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 12:28:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Usefull PHP]]></category>
		<category><![CDATA[link rotator]]></category>
		<category><![CDATA[php link rotator]]></category>
		<category><![CDATA[php random]]></category>
		<category><![CDATA[php tutorial]]></category>
		<category><![CDATA[random link]]></category>

		<guid isPermaLink="false">http://www.crivionweb.com/phpblog/?p=27</guid>
		<description><![CDATA[Hi, In this php tutorial you will learn how to build a random link rotator. Basically, we&#8217;ll build a php array with the links needed to rotate and then we&#8217;ll print to user the link randomly. &#60;?php $links = array("link &#8230; <a href="http://readytousesolutions.com/phpblog/php-tutorial-random-link-rotator/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>In this php tutorial you will learn how to build a random link rotator. Basically, we&#8217;ll build a php array with the links needed to rotate and then we&#8217;ll print to user the link randomly.</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
$links <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span><span class="phpString">"link <span class="phpNumber">1</span>"</span>, <span class="phpString">"link <span class="phpNumber">2</span>"</span>, <span class="phpString">"link <span class="phpNumber">3</span>"</span><span class="phpOperator">)</span><span class="phpText">;</span>
$max <span class="phpOperator">=</span> <span class="phpFunction">sizeof</span><span class="phpOperator">(</span>$links<span class="phpOperator">)</span><span class="phpText">;</span>
$<span class="phpFunction">rand</span> <span class="phpOperator">=</span> <span class="phpFunction">rand</span><span class="phpOperator">(</span><span class="phpNumber">0</span>, $max<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpFunction">print</span> $links<span class="phpOperator">[</span>$<span class="phpFunction">rand</span><span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://readytousesolutions.com/phpblog/php-tutorial-random-link-rotator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP Tutorial : Function &#8211; Filter unwanted words</title>
		<link>http://readytousesolutions.com/phpblog/php-tutorial-function-filter-unwanted-words/</link>
		<comments>http://readytousesolutions.com/phpblog/php-tutorial-function-filter-unwanted-words/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 12:06:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Short PHP Functions]]></category>
		<category><![CDATA[custom php function]]></category>
		<category><![CDATA[filter unwanted words]]></category>
		<category><![CDATA[php filter]]></category>
		<category><![CDATA[php function]]></category>
		<category><![CDATA[php tutorial]]></category>

		<guid isPermaLink="false">http://www.crivionweb.com/phpblog/?p=3</guid>
		<description><![CDATA[Hello, I finded it usefull to build a simple and maximum 10 lines of code php function which can be used in filtering words that you wouldn&#8217;t want to appear on your website, forum, guestbook, comments, etc. The most common &#8230; <a href="http://readytousesolutions.com/phpblog/php-tutorial-function-filter-unwanted-words/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>I finded it usefull to build a simple and maximum 10 lines of code php function which can be used in filtering words that you wouldn&#8217;t want to appear on your website, forum, guestbook, comments, etc.</p>
<p>The most common way where is to use it within a html form, validating an input, textarea element, etc.</p>
<p>The code is built and commented below :</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpComment">//call the special word which builds a<span class="phpKeyword"> new </span><span class="phpFunctionKeyword">function</span>
</span>
<span class="phpComment">//custom php <span class="phpFunctionKeyword">function</span> and give it a nice name
</span><span class="phpFunctionKeyword">function</span><span class="htmlText"> filterMe</span><span class="phpOperator">(</span>$whatToFilter, $listOfUnwantedWords<span class="phpOperator">)</span>
<span class="phpOperator">{</span>
<span class="phpKeyword">
foreach </span><span class="phpOperator">(</span>$listOfUnwantedWords<span class="phpKeyword"> as </span>$value<span class="phpOperator">)</span> <span class="phpOperator">{</span>
<span class="phpKeyword">
if </span><span class="phpOperator">(</span><span class="phpFunction">preg_match</span><span class="phpOperator">(</span><span class="phpString">"/$value/i"</span>, <span class="phpString">"$whatToFilter"</span><span class="phpOperator">)</span><span class="phpOperator">)</span> <span class="phpOperator">{</span>
<span class="htmlText">
print </span><span class="phpString">"You have used an unallowed word"</span><span class="phpText">;</span>
<span class="phpFunction">exit</span><span class="phpOperator">(</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpOperator">}</span>
<span class="phpOperator">}</span>
<span class="phpOperator">}</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<p>Usage of this php function to filter unwanted words : firstly, build an php array with unwanted words, then apply the function where you need it. Example :</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
<span class="phpComment">//create <span class="phpFunction">array</span> with not wanted words
</span>
$Unwanted <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span><span class="phpString">"www"</span>, <span class="phpString">"mywebsite"</span>, <span class="phpString">"etc"</span><span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">//estabilish which given word to filter
</span>
$word <span class="phpOperator">=</span> <span class="phpScriptVar">$_POST</span><span class="phpOperator">[</span><span class="phpString">'yourinput'</span><span class="phpOperator">]</span><span class="phpText">;</span>
<span class="phpComment">//<span class="phpFunctionKeyword">function</span> in action
</span>
<span class="htmlText">
filterMe</span><span class="phpOperator">(</span>$word, $Unwanted<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<p>Feel free to use it anywhere!</p>
]]></content:encoded>
			<wfw:commentRss>http://readytousesolutions.com/phpblog/php-tutorial-function-filter-unwanted-words/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

