<?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>Colin Jensen &#187; tutorial</title>
	<atom:link href="http://www.colinjensen.co.uk/blog/tag/tutorial/feed" rel="self" type="application/rss+xml" />
	<link>http://www.colinjensen.co.uk/blog</link>
	<description>Technology, Gadgets, Website Design and Development, Windows Mobile.</description>
	<lastBuildDate>Thu, 13 Aug 2009 17:02:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tutorial &#8211; How to use arrays in php</title>
		<link>http://www.colinjensen.co.uk/blog/web-related/php/tutorial-how-to-use-arrays-in-php</link>
		<comments>http://www.colinjensen.co.uk/blog/web-related/php/tutorial-how-to-use-arrays-in-php#comments</comments>
		<pubDate>Thu, 26 Jun 2008 19:00:09 +0000</pubDate>
		<dc:creator>Colin Jensen</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[advanced arrays]]></category>
		<category><![CDATA[array tutorial]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[easy array]]></category>
		<category><![CDATA[how to use arrays]]></category>
		<category><![CDATA[php arrays]]></category>
		<category><![CDATA[php.net arrays]]></category>
		<category><![CDATA[simple arrays]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.colinjensen.co.uk/blog/?p=19</guid>
		<description><![CDATA[Using arrays in PHP can be a very powerful technique of handling data.
If you are not familiar with arrays in PHP then use simple code!
Example of simple code.
$fruit['apples'] = 'I like apples';

$fruit['oranges'] = 'I like oranges';

$fruit['banana'] = 'I like bananas';
Example of advanced code.
$fruit = array("apples" =&#62; 'I like apples', "oranges" =&#62; 'I like oranges', "banana" [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><strong>Using <a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">arrays</a> in <a title="http://www.php.net" href="http://www.php.net" target="_blank">PHP</a> can be a very powerful technique of handling </strong><strong>data.</strong></p>
<p>If you are not familiar with arrays in <a title="http://www.php.net" href="http://www.php.net" target="_blank">PHP</a> then use simple code!</p>
<p><strong>Example of simple code.</strong></p>
<blockquote><p>$fruit['apples'] = 'I like apples';<br />

$fruit['oranges'] = 'I like oranges';<br />

$fruit['banana'] = 'I like bananas';</p></blockquote>
<p><strong>Example of advanced code.</strong></p>
<blockquote><p>$fruit = array("apples" =&gt; 'I like apples', "oranges" =&gt; 'I like oranges', "banana" =&gt; 'I like bananas');</p></blockquote>
<p>Using advanced code saves lines in the source code but if you are not familiar with arrays it could be harder to troubleshoot if you get parse errors.  Once you feel confident with <a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">arrays</a> then I would recommend using advanced code.</p>
<p><strong>Reading from <a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">arrays</a>.</strong></p>
<p><a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">Arrays</a> are very simple to read from.  Using our example code above, to see the value of Apples we would use</p>
<blockquote><p>echo $fruit['apples'];<br />
<br />
this would return: I like apples</p></blockquote>
<p><strong>Looping through <a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">arrays</a></strong></p>
<p>Looping through <a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">arrays</a> is easy too, but this is where people usually get stuck.  Just look at it from a logical point of view.  We are going to use the foreach function to go through the <a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">array</a>.</p>
<blockquote><p>foreach($fruit as $key =&gt; $value) {</p>
<p style="padding-left: 30px;">echo $key . ' : ' . $value . '&lt;br /&gt;';</p>
<p>}</p>
<p>This would return:<br />
apples : I like apples<br />
oranges: I like oranges<br />
banana: I like bananas</p></blockquote>
<p>Using the foreach function above, think of $key as the name and $value as the information we assigned.</p>
<p><strong>If you would like any more information regarding <a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">arrays</a> then please leave a comment or visit the <a title="http://uk3.php.net/manual/en/function.array.php" href="http://uk3.php.net/manual/en/function.array.php" target="_blank">PHP manual by clicking here</a></strong></p>
<!-- google_ad_section_end --><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.colinjensen.co.uk%2Fblog%2Fweb-related%2Fphp%2Ftutorial-how-to-use-arrays-in-php&amp;linkname=Tutorial%20%26%238211%3B%20How%20to%20use%20arrays%20in%20php"><img src="http://www.colinjensen.co.uk/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.colinjensen.co.uk/blog/web-related/php/tutorial-how-to-use-arrays-in-php/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
