<?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 Programming Tips</title>
	<atom:link href="http://phpprogrammingtips.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpprogrammingtips.net</link>
	<description></description>
	<lastBuildDate>Tue, 10 Aug 2010 18:17:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Array_diff_uassoc Function</title>
		<link>http://phpprogrammingtips.net/basic-programming/array_diff_uassoc-function/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/array_diff_uassoc-function/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 18:17:35 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[php array_diff functions]]></category>
		<category><![CDATA[php basics]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/array_diff_uassoc-function/</guid>
		<description><![CDATA[
Next in line is array_diff_uassoc() function which compares two or more arrays while checking for differences before comparing the keys with a user-defined location. It then returns an array withthe keys and values from the first array(to which all the values were comapred against) it the function allows it. Syntax is as follows : array_diff_uassoc(array1,array2,array3&#8230;.,function). [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mindphp.com/modules.php%3Fname%3DPHP_Manual%26page%3Dfunction.array-diff-uassoc.html"><img src="/wp-content/uploads/scraped/23.jpg"/></a>
<p>Next in line is array_diff_uassoc() function which compares two or more arrays while checking for differences before comparing the keys with a user-defined location. It then returns an array withthe keys and values from the first array(to which all the values were comapred against) it the function allows it. Syntax is as follows : array_diff_uassoc(array1,array2,array3&#8230;.,function). with a sample below of how it is used.</p>
<p><?php<br />
function userdefined($v1,$v2)<br />
{<br />
if ($v1 === $v2)<br />
	{<br />
	return 0;<br />
	}<br />
if ($v1 > $v2)<br />
	{<br />
	return 1;<br />
	}<br />
else<br />
	{<br />
	return -1;<br />
	}<br />
}<br />
$a1=array(0=>&#8221;Dog&#8221;,1=>&#8221;Cat&#8221;,2=>&#8221;Horse&#8221;)<br />
$a2=array(3=>&#8221;Dog&#8221;,1=>&#8221;Cat&#8221;,5=>&#8221;Horse&#8221;)<br />
print_r(array_diff_uassoc($a1,$a2,&#8221;userdefined&#8221;));<br />
?></p>
<p>which results in the following output : Array( [0] => Dog [2] => Horse). For an example of the same function with two or more assigned arrays to the function:</p>
<p><?php<br />
function userdefined($v1,$v2)<br />
{<br />
if ($v1 === $v2)<br />
	{<br />
	return 0;<br />
	}<br />
if ($v1 > $v2)<br />
	{<br />
	return 1;<br />
	}<br />
else<br />
	{<br />
	return -1;<br />
	}<br />
}<br />
$a1=array(0=>&#8221;Dog&#8221;,1=>&#8221;Cat&#8221;,2=>&#8221;Horse&#8221;)<br />
$a2=array(3=>&#8221;Dog&#8221;,1=>&#8221;Cat&#8221;,5=>&#8221;Horse&#8221;)<br />
$a3=array(6=>&#8221;Onyx&#8221;,0=>&#8221;Dog&#8221;,5=>&#8221;Horse&#8221;)<br />
print_r(array_diff_uassoc($a1,$a2,$a3,&#8221;userdefined&#8221;));<br />
?></p>
<p>Which in turn, gives you : Array ([2] => Horse )</p>
<p>So we see the different array_diff function variants and the diffeerent ways they are used to compare the values of one or more arrays with one another.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/array_diff_uassoc-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Array_diff Function</title>
		<link>http://phpprogrammingtips.net/basic-programming/array_diff-function/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/array_diff-function/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 18:13:34 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[array_diff()]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[php array handling]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/array_diff-function/</guid>
		<description><![CDATA[
The first function, array_diff() is used for comparing several tables or arrays which gives an array with the keys and values from the first array if the value is not available in the other arrays. Syntax is as follows : array_diff(array1,array2,array3&#8230;&#8230;), where array 1 is the table to which all the other arrays will be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.martydooginarts.com/"><img src="/wp-content/uploads/scraped/21.jpg"/></a>
<p>The first function, <strong>array_diff()</strong> is used for comparing several tables or arrays which gives an array with the keys and values from the first array if the value is not available in the other arrays. Syntax is as follows : array_diff(array1,array2,array3&#8230;&#8230;), where array 1 is the table to which all the other arrays will be compared to. The 2nd array(array 2) is an array that is compared with the first array and so on and so forth. Below is sample code of its use and the outcome of the functions comparison :</p>
<p><?php<br />
$a1=array(0=>&#8220;Mouse&#8221;,1=>&#8221;Cat&#8221;,2=>&#8221;Dog&#8221;);<br />
$a2=array(3=>&#8221;Dog&#8221;,4=>&#8221;Cat&#8221;,5=>&#8221;Lizard&#8221;);<br />
print_r(array_diff($a1,$a2));<br />
?></p>
<p>Giving you the result : Array( [0] =>Mouse )</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/array_diff-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Array Count Values</title>
		<link>http://phpprogrammingtips.net/basic-programming/array-count-values/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/array-count-values/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 18:12:39 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Array Functions]]></category>
		<category><![CDATA[Array_diff_(functions)]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/array-count-values/</guid>
		<description><![CDATA[
The array_count_values() function returns an array which contains the keys of the original array&#8217;s value and the value is the number of occurences. A sample of it&#8217;s use is shown below:

Which would give us an output of : Array ( [Mouse]=> 1 [Cat]=> 2 [Dog]=> 1 )
The next functions are used to compare the contents [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.techonthenet.com/excel/questions/array2.php"><img src="/wp-content/uploads/scraped/20.jpg"/></a>
<p>The array_count_values() function returns an array which contains the keys of the original array&#8217;s value and the value is the number of occurences. A sample of it&#8217;s use is shown below:</p>
<p><?php<br />
$a=array("Mouse","Cat","Dog","Cat");<br />
print_r(array_count_values($a));<br />
?></p>
<p>Which would give us an output of : Array ( [Mouse]=> 1 [Cat]=> 2 [Dog]=> 1 )</p>
<p>The next functions are used to compare the contents of one array against one or more arrays either returning the key, keys and contents or solely the contents of the specified fields that result from their comparisons. They are array_diff(), array_diff_assoc(), array_diff_key(), array_diff_uassoc() and array_diff_ukey(). all of these are used to determine the difference between a set of arrays returning either the keys or contents to give the results of the said array comparison/s.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/array-count-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Programming Basics</title>
		<link>http://phpprogrammingtips.net/basic-programming/more-programming-basics/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/more-programming-basics/#comments</comments>
		<pubDate>Mon, 10 May 2010 14:39:09 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Data Types]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/more-programming-basics/</guid>
		<description><![CDATA[
As with all programming languages PHP has different variable types such as numeric, character, string and Boolean types. Boolean variables in PHP always return either true or false, integers are whole numbers, floating points are decimal or scientifically notated and strings are a chain of characters. Sounds familiar, well they are and they are mostly [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10779/oci02bas.htm"><img src="/wp-content/uploads/scraped/15.jpg"/></a>
<p>As with all programming languages PHP has different variable types such as numeric, character, string and Boolean types. Boolean variables in PHP always return either true or false, integers are whole numbers, floating points are decimal or scientifically notated and strings are a chain of characters. Sounds familiar, well they are and they are mostly standard across the various programming languages. For a more in-depth discussion on the different data types of PHP go visit the <strong><a href="http://www.php.net/manual/en/language.types.php">manual page</a></strong>.<br />
We next discuss operators such as the assignment operator which allows you to assign values to variables allowing complex operations to be constructed into more and more functional programs.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/more-programming-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP and other Programming Languages</title>
		<link>http://phpprogrammingtips.net/basic-programming/php-and-other-programming-languages/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/php-and-other-programming-languages/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 14:38:06 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Operators]]></category>
		<category><![CDATA[Variables]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/php-and-other-programming-languages/</guid>
		<description><![CDATA[
The major notable difference with PHP against other languages with regards to variables is that PHP is more &#8220;intelligent&#8221;. In C for example, variables have to be explicitly defined as either numeric or alpha-numeric and can only be used to store that defined specific form of data. PHP like all other languages supports a lot [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://news.cnet.com/8301-13505_3-10009669-16.html"><img src="/wp-content/uploads/scraped/14.jpg"/></a>
<p>The major notable difference with PHP against other languages with regards to variables is that PHP is more &#8220;intelligent&#8221;. In C for example, variables have to be explicitly defined as either numeric or alpha-numeric and can only be used to store that defined specific form of data. PHP like all other languages supports a lot of variable types such as integers, floating point numbers, arrays and strings but with one major difference, variables are recognized automatically based on their use and the context of their use. This makes your (programmer&#8217;s) life a whole lot easier. PHP variables are defined with a &#8220;$&#8221; symbol preceding the variable name. It should also begin with either an underscore or an alpha character.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/php-and-other-programming-languages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embedding Comments</title>
		<link>http://phpprogrammingtips.net/basic-programming/embedding-comments/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/embedding-comments/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 14:38:06 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Basic PHP]]></category>
		<category><![CDATA[Comments]]></category>
		<category><![CDATA[Sample]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/embedding-comments/</guid>
		<description><![CDATA[
Now, to make you a better programmer we all know the value of comments. This allows you to understand the code that you have written defining and given meaning to operations as you build them up. You start with the terminators used by PHP and end with them as well. Single line comments look like [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.digitalalchemy.tv/2007/06/watch-ted-talks-technology.html"><img src="/wp-content/uploads/scraped/13.jpg"/></a>
<p>Now, to make you a better programmer we all know the value of comments. This allows you to understand the code that you have written defining and given meaning to operations as you build them up. You start with the terminators used by PHP and end with them as well. Single line comments look like this �// comment� and Multi-line ones use the syntax /* comment comment*/. A better example would be the one below:</p>
<p><?php<br />
//comment<br />
/* comment<br />
Comment*/<br />
?></p>
<p>In the next post we take on the best parts of PHP which would be variables which is essential in all programming languages.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/embedding-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More into the syntax of PHP</title>
		<link>http://phpprogrammingtips.net/basic-programming/more-into-the-syntax-of-php/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/more-into-the-syntax-of-php/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 14:36:07 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[PHP Syntax]]></category>
		<category><![CDATA[Program]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/more-into-the-syntax-of-php/</guid>
		<description><![CDATA[
As you might have seen, all of the PHP statement ends with �;� which would be somewhat similar to Perl. The valid HTML code that was handed back to the server was :



Who are You?

My name is MacGyver.


More in the coming posts when we dig deeper as we widen our understanding of PHP.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://%25E2%259C%258E.net/category/php/"><img src="/wp-content/uploads/scraped/12.jpg"/></a>
<p>As you might have seen, all of the PHP statement ends with �;� which would be somewhat similar to Perl. The valid HTML code that was handed back to the server was :<br />
<html><br />
<head></head><br />
<body><br />
Who are You?<br />
<br />
My name is MacGyver.<br />
</body><br />
</html></p>
<p>More in the coming posts when we dig deeper as we widen our understanding of PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/more-into-the-syntax-of-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Basics</title>
		<link>http://phpprogrammingtips.net/basic-programming/php-basics/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/php-basics/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 14:33:54 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[PHP Syntax]]></category>
		<category><![CDATA[Program Basics]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/php-basics/</guid>
		<description><![CDATA[
Now that you have installed the necessary web server software and tested that it works (which is included in the manual) we can now get to know the basics of PHP.  For our guide we will be using HTTP combined with PHP, this allows PHP code to be embedded into regular html pages and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.dreamincode.net/forums/showtopic35660.htm"><img src="/wp-content/uploads/scraped/10.jpg"/></a>
<p>Now that you have installed the necessary web server software and tested that it works (which is included in the manual) we can now get to know the basics of PHP.  For our guide we will be using <strong><a href=http://www.w3.org/Protocols/>HTTP</a></strong> combined with PHP, this allows PHP code to be embedded into regular html pages and thus simplifying the execution by simply requesting the page. PHP uses start and stop tags in the form of &#8220;?php&#8221; and &#8220;?&#8221; and below is a sample:</p>
<p><?php<br />
".. PHP Code".<br />
?></p>
<p>The following sample has PHP code embedded within HTTP:<br />
<html><br />
<head></head><br />
<body><br />
Fan: Who are You?<br />
<br />
<?php<br />
//print output<br />
Echo "My name is MacGyver";?><br />
</body><br />
</html></p>
<p>Upon execution or opening the page this would give you text in the browser stating the following words. &#8220;<strong>Who are You?</strong>&#8221; &#8220;<strong>My name is MacGyver</strong>&#8220;. This would be the equivalent hello world program many books use in teaching the basics of programming.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/php-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Array Chunk Function</title>
		<link>http://phpprogrammingtips.net/basic-programming/array-chunk-function/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/array-chunk-function/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 11:14:57 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Array manipulation]]></category>
		<category><![CDATA[Programming PHP]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/array-chunk-function/</guid>
		<description><![CDATA[
The array_chunk() function on the on the other hand as the name implies, divides an array into chunks or several tables from the source table. The syntax goes something like array_chunk(array,size,preserve_key), wherein the array is the table that would be divided, the size is the number of elements which the new arrays are to contain [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://smallcode.weblogs.us/2006/07/"><img src="/wp-content/uploads/scraped/18.jpg"/></a>
<p>The array_chunk() function on the on the other hand as the name implies, divides an array into chunks or several tables from the source table. The syntax goes something like array_chunk(array,size,preserve_key), wherein the array is the table that would be divided, the size is the number of elements which the new arrays are to contain and the preserve key which can either be true or false is used to either retain or revise the key or pointer value of the original table. An example is shown below:</p>
<p><?php<br />
$a=array(�a�=>�Cat�, �b�=>�Dog�, �c�=>�Horse�,�d�=>�Cow�);<br />
print_r(array_chunk($a,2);<br />
?></p>
<p>The code would have an output of:</p>
<p>Array (<br />
[0] => Array ( [0] = > Cat    [1] => Dog )<br />
[1] => Array ( [0] => Horse [1] => Cow )<br />
)</p>
<p>As we can see, the original array has been divided into two arrays array0 and array1 and a value that is not given for the key had it assigned a new key for each of the tables. Another example would be :</p>
<p><?php<br />
$a=array(�a�=>�Cat�, �b�=>�Dog�, �c�=>�Horse�,�d�=>�Cow�);<br />
print_r(array_chunk($a,2,true);<br />
?></p>
<p>This would then give us ;<br />
Array (<br />
[0] => Array ( [a] = > Cat    [b] => Dog )<br />
[1] => Array ( [c] => Horse [d] => Cow )<br />
)</p>
<p>This shows the significance of the retain key field wherein the two new arrays retained their original keys. The reverse of which would be the array_combine() which divided the array into one which holds the keys and one with the values.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/array-chunk-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arrays : Changing cases</title>
		<link>http://phpprogrammingtips.net/basic-programming/arrays-%e2%80%93-changing-cases/</link>
		<comments>http://phpprogrammingtips.net/basic-programming/arrays-%e2%80%93-changing-cases/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 11:13:56 +0000</pubDate>
		<dc:creator>Drew</dc:creator>
				<category><![CDATA[Basic Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Array manipulation]]></category>
		<category><![CDATA[Programming PHP]]></category>

		<guid isPermaLink="false">http://phpprogrammingtips.net/uncategorized/arrays-%e2%80%93-changing-cases/</guid>
		<description><![CDATA[
This form of array declaration allows one to change the case from uppercase to lowercase and vice versa. The syntax goes as follows:
array_change_key_case(array,case)
The array part, specifies which table or array to use and is a required field which is not the case with the key which is automatically assigned a value. An example of it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://askbobrankin.com/what_is_raid.html"><img src="/wp-content/uploads/scraped/17.jpg"/></a>
<p>This form of array declaration allows one to change the case from uppercase to lowercase and vice versa. The syntax goes as follows:</p>
<p>array_change_key_case(array,case)</p>
<p>The array part, specifies which table or array to use and is a required field which is not the case with the key which is automatically assigned a value. An example of it&#8217;s use can be seen below:</p>
<p><?php<br />
$a=array('a'=>&#8220;Mouse&#8221;,&#8217;b'=>&#8221;Rat&#8221;,&#8217;c'=>&#8221;Rodent&#8221;,&#8217;d'=>&#8221;Cat&#8221;);<br />
print_r(array_change_key_case($a,CASE_UPPER));<br />
?></p>
<p>The output of the said commands will be:<br />
Array ( [A] => Mouse [B] => Rat [C] => Rodent [D] => Cat)</p>
<p>Another example of it&#8217;s use would be:</p>
<p><?php<br />
$a=array('a'=>&#8220;Mouse&#8221;,&#8217;B'=>&#8221;Rat&#8221;,&#8217;c'=>&#8221;Rodent&#8221;,&#8217;b'=>&#8221;Cat&#8221;);<br />
print_r(array_change_key_case($a,CASE_UPPER));<br />
?></p>
<p>That returns the following values respectively:<br />
Array ( [A] => Mouse [B] => Rat [C] => Rodent [D] => Cat)</p>
<p>In the next post, we would discuss an array function that divides a large array into several chunks of separate arrays.</p>
]]></content:encoded>
			<wfw:commentRss>http://phpprogrammingtips.net/basic-programming/arrays-%e2%80%93-changing-cases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
