<?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>Helpfolder</title>
	<atom:link href="http://helpfolder.com/feed" rel="self" type="application/rss+xml" />
	<link>http://helpfolder.com</link>
	<description></description>
	<lastBuildDate>Sun, 05 Feb 2012 00:46:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Codeigniter Setup on Xampp and Uniform Server</title>
		<link>http://helpfolder.com/60/codeigniter-setup-on-xampp-and-uniform-server</link>
		<comments>http://helpfolder.com/60/codeigniter-setup-on-xampp-and-uniform-server#comments</comments>
		<pubDate>Sun, 05 Feb 2012 00:45:17 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=60</guid>
		<description><![CDATA[Learn How to Setup Codeigniter with Xampp and Uniform Server. Codeigniter is one of the popular PHP framework that is suitable for many new php programmers. Codeigniter is lightweight and is relatively easy to understand php framework compared to cakephp and other frameworks. In this tutorial, we will setup codeigniter and get things running with [...]]]></description>
			<content:encoded><![CDATA[<p>Learn How to Setup Codeigniter with Xampp and Uniform Server. Codeigniter is one of the popular PHP framework that is suitable for many new php programmers. Codeigniter is lightweight and is relatively easy to understand php framework compared to cakephp and other frameworks. In this tutorial, we will setup codeigniter and get things running with XAMPP and Uniform server. <span id="more-60"></span>I am explaining codeigniter setup using both of these web servers just so that if anyone wants to use one of these will find it easy to setup. </p>
<p>We’re covering both webservers here so skip the steps of webserve which doesn’t apply to you. </p>
<p><strong>Xampp and Codeigniter Setup</strong>: </p>
<p>First thing we are going to do is setup Xampp for those who want to use codeigniter with xampp. So go ahead and download either portable version or developer version of <a href="http://www.apachefriends.org/en/xampp.html">xampp</a>. Install it in the directory (and drive) as per your choice. Once you copy all the files of xampp in directory, find the start.bat file to start the xampp server. You can also click on xampp control panel to manually start xampp services. </p>
<p>Second Download <a href="http://codeigniter.com">Codeigniter</a> and extract the files in “htdocs” folder of xampp. You can make the path something like this : <em>/htdocs/codeigniter or /htdocs/ci</em>. You can also rename the codeigniter folder as per your choice. </p>
<p>You can start the server and test the codeigniter setup at <em>http://localhost/codeigniter</em> or if you have renamed the codeigniter folder to something else, use that name. </p>
<p><strong>Uniform Server and Codeigniter Setup</strong>: </p>
<p><a href="http://www.uniformserver.com/">Unifrom server</a> is very easy to setup and is much better to manage sometimes compared to xampp. You can download uniform server and extrac it to the drive (and in turn directory) of your choice. Once extracted, navigate to the following directory: <em>\UniServer\udrive\www</em>. Inside the ‘www’ folder you have to extract the codeigniter. You can rename codeigniter to something simple if you wish that will definitely help while coding multiple codeigniter projects. </p>
<p>Start the server by going to following address: <em>http://localhost/CI</em>. </p>
<p>You will see the image as shown below in the screenshot.<br />
<img src="http://helpfolder.com/wp-content/uploads/2012/02/codeigniter_uniform_server-300x143.jpg" alt="" title="codeigniter_uniform_server" width="300" height="143" class="aligncenter size-medium wp-image-61" /></p>
<p>If you want to create your own welcome message for the application, you should edit the following file. </p>
<p><em>application/views/welcome_message.php</em></p>
<p>This completes our simple codeigniter setup tutorial. In next few tutorials, we will see how to setup dynamic websites and later in more advanced tutorials we will check out how to create simple blogs and forums. I hope this simple tutorial helps you to setup codeigniter on your development server. </p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/60/codeigniter-setup-on-xampp-and-uniform-server/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Regular Expressions</title>
		<link>http://helpfolder.com/56/php-regular-expressions</link>
		<comments>http://helpfolder.com/56/php-regular-expressions#comments</comments>
		<pubDate>Thu, 26 Jan 2012 18:11:04 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=56</guid>
		<description><![CDATA[Regular expressions are the patterns that allow you to processs text based on certain requirement. This in turn produces the sequence or pattern of text that is based on pattern-matching as per developers needs. You can do a lot of things using regular expressions. For example, you can filter our the text in uppercase or [...]]]></description>
			<content:encoded><![CDATA[<p>Regular expressions are the patterns that allow you to processs text based on certain requirement. This in turn produces the sequence or pattern of text that is based on pattern-matching as per developers needs. You can do a lot of things using regular expressions. <span id="more-56"></span>For example, you can filter our the text in uppercase or replace the word with something else, match the group of text and filter the content. There are plenty of other ways to use the regular expression as per your needs.</p>
<p>PHP allows you to use two types of regular expressions.</p>
<ul>
<li>POSIX Regular Expressions</li>
<li>PERL Style Regular Expressions</li>
</ul>
<p>I suggest you to follow the PERL Compatible Regular expressions as they&#8217;re widely used. There isn&#8217;t much difference between POSIX and PCRE but you&#8217;ve to learn separately to know them better.</p>
<p>There are ways to explain the valid and invalid patterns of regular expressions. I suggest you to use the examples to learn about these valid patterns. This is the reason I am not going to explain you every little expression, Instead you&#8217;ll learn from the examples posted here.</p>
<p>Let&#8217;s take a look at important perl compatible regular expression functions.</p>
<p><strong>preg_match()</strong> : This function performs a regular expression match. Check the following code to see it in action.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> php
<span style="color: #000088;">$str</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;this is demo&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$str1</span><span style="color: #339933;">=</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/this/&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$str2</span><span style="color: #339933;">=</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/that/&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$str1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br/&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$str2</span><span style="color: #339933;">;</span>
? <span style="color: #339933;">&gt;</span></pre></div></div>

<p>Check the output and you&#8217;ll see that it shows 1 and 0. Here value 1 means we have found match and 0 means that there is no match. You can process much more complex data with the help of loops and reg operators.</p>
<p><strong>preg_replace()</strong>: This function performs regular expression search and replace operation. See the following code so that you get idea of how preg_replace() works.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> php
<span style="color: #000088;">$data</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Here is some simple text&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$find</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/is/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$replace</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;is our&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$find</span><span style="color: #339933;">,</span><span style="color: #000088;">$replace</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
? <span style="color: #339933;">&gt;</span></pre></div></div>

<p>There are two more optional arguments that you can pass to the preg_replace() to count the replacements and also to restrict the number of replacements of text.</p>
<p><strong>preg_split()</strong>: This function takes your input and then split the input into multiple arrays. The value in array is dependent on your operator usage for spliting the text. PREG_SPLIT_NO_EMPTY argument ensures that no empty results are passed to the output of array. Check the following code on preg_split and see how we&#8217;re spliting the two statements that are separated with dot.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> php
<span style="color: #000088;">$data</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Here is some simple text. Run the program&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$prodata</span><span style="color: #339933;">=</span><span style="color: #990000;">preg_split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\./'</span><span style="color: #339933;">,</span><span style="color: #000088;">$data</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>PREG_SPLIT_NO_EMPTY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$prodata</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
? <span style="color: #339933;">&gt;</span></pre></div></div>

<p>Check the output and you&#8217;ll see that it splits the sentences in two arrays starting from [0].</p>
<p>This was just short introduction on regular expressions in php. You can read more about regular expressions in general from wikipedia. If you&#8217;re python programmer then do read <a href="http://onecore.net/regular-expressions-in-python.htm">python regular expressions</a> tutorial.</p>
<p>Feel free to let me know your suggestions and feedback on this tutorial. I would love to improve if there are any constructive criticisms in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/56/php-regular-expressions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Solution to the Project Euler Problem 1</title>
		<link>http://helpfolder.com/48/php-solution-to-the-project-euler-problem-1</link>
		<comments>http://helpfolder.com/48/php-solution-to-the-project-euler-problem-1#comments</comments>
		<pubDate>Fri, 09 Dec 2011 20:30:18 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=48</guid>
		<description><![CDATA[This is one of the easiest problem in the project euler archive. You can perform this problem in any language of your choice. As this site is specifically for web developers so i&#8217;m focusing on php for this post. You can change the code to get answer in C, C++ or any other language of [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of the easiest problem in the project euler archive. You can perform this problem in any language of your choice. As this site is specifically for web developers so i&#8217;m focusing on php for this post. You can change the code to get answer in C, C++ or any other language of your choice. <span id="more-48"></span>Depending on your language, few changes will be there but that&#8217;s upto you to fix. As this tutorial deals with the PHP code, I can tell you for sure that this code works. </p>
<p>You can check the problem <a href="http://projecteuler.net/problem=1">here</a>. It says :</p>
<blockquote><p>If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.</p>
<p>Find the sum of all the multiples of 3 or 5 below 1000.</p></blockquote>
<p><strong>Thought Process</strong> &#8211; If you take a look at this problem you&#8217;ll observe that only numbers that are multiples of 3 and 5 are &#8211; 3, 5,6,9. You have to repeat this process for 1000 numbers in your program. Yes, you guessed it right we&#8217;re going to use loop in our program. We&#8217;re going to run a loop that counts upto 1000. We also need to check for the condition that checks the number is divisble by 3 and 5 and remainder is 0. In such case we&#8217;re going to use if condition inside our for loop to filter those numbers and it in our another variable that keep the sum.</p>
<p>You can see this in action in following code:</p>
<p><strong>Code</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$j</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$k</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$j</span><span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span><span style="color: #000088;">$j</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span><span style="color: #339933;">%</span><span style="color:#800080;">3</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">||</span><span style="color: #000088;">$j</span><span style="color: #339933;">%</span><span style="color:#800080;">5</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$k</span><span style="color: #339933;">+=</span><span style="color: #000088;">$j</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;The sum of Multiples of 3 and 5 is: &quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$k</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This is very simple problem and I guess you should attempt it as much as possible before looking at this site for answer. If you manage to learn it in php, try to impement the logic in python or C# or C++. This will improve your language learning and logic too. </p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/48/php-solution-to-the-project-euler-problem-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Loops</title>
		<link>http://helpfolder.com/45/php-loops</link>
		<comments>http://helpfolder.com/45/php-loops#comments</comments>
		<pubDate>Thu, 08 Dec 2011 08:19:26 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=45</guid>
		<description><![CDATA[PHP like any other programming language makes use of loops to perform particular task repeatedly. You can use loops to perform tasks that are supposed to be executed if certain condition is met upto particular period. Like this there are many ways to use loops while programming with php. In this tutorial we&#8217;re going to [...]]]></description>
			<content:encoded><![CDATA[<p>PHP like any other programming language makes use of loops to perform particular task repeatedly. You can use loops to perform tasks that are supposed to be executed if certain condition is met upto particular period. <span id="more-45"></span>Like this there are many ways to use loops while programming with php. In this tutorial we&#8217;re going to take a look at ways with which we can use loops in php. </p>
<p>Loops always check for the particular condition before executing particular task. If the condition is true or false, it&#8217;ll generate the output for the loop. </p>
<p><strong>While Loop</strong></p>
<p>Let&#8217;s start learning with &#8216;while&#8217; loop first. Check the basic syntax of the while loop:</p>
<p><strong>Code</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>condition<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>You&#8217;ve to place some condition in order to execute while loop. If your condition evalutes to true, the loop will execute or lese it&#8217;ll not.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$i</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong><br />
For Loop</strong></p>
<p>For loop allows you to have control over initiation, condition and increment in the same line. Like while loop it also processes a block of code until a statement becomes false. </p>
<p><strong>Syntax Code:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>condition<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>In this code our condition statement contains &#8211; <em>initiation, condition and increment</em>. You can skip increment if you want to use it inside the block of code. Either way with increment is fine with for loop. Check the modification in code made  for &#8211; &#8220;for loop&#8221;.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>$<span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$i</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>FOREACH Loop</strong></p>
<p>A <em>foreach</em> loop is used when you&#8217;re dealing with arrays. It executes a block of code as long as loop uses all the values of arrays specified in the condition are used. Once those values are used then loop ends. So there is no need to explicitly add the increment for the arrays. </p>
<p><strong>Syntax</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$j</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>In this loop, we&#8217;re creating an array to be used <em>foreach</em> loop. This array specifies a particular set of values upto which the loop will execute.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$k</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br/&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>As you can see in the output, this loop executes till all the values in array are used. Once used you can see that loop ends. </p>
<p>These three are the types of loops that you&#8217;re going to use while programming in php. Hope this tutorial helps to you and if you have any suggestion or feedback on these tutorials, feel free to let us know. </p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/45/php-loops/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Redirect Users using PHP</title>
		<link>http://helpfolder.com/43/how-to-redirect-users-using-php</link>
		<comments>http://helpfolder.com/43/how-to-redirect-users-using-php#comments</comments>
		<pubDate>Wed, 07 Dec 2011 15:55:26 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=43</guid>
		<description><![CDATA[There are many instances where redirection saves a lot of time. You can create a redirection to forwards users to a page which is translated for their locale. You can use redirection for affiliate link and you can also use redirection to avoid non-local folks to English version of your site. You can also redirect [...]]]></description>
			<content:encoded><![CDATA[<p>There are many instances where redirection saves a lot of time. You can create a redirection to forwards users to a page which is translated for their locale. You can use redirection for affiliate link and you can also use redirection to avoid non-local folks to English version of your site. <span id="more-43"></span>You can also redirect users from 404 page to homepage in order to help in SEO. There are many other uses of redirection script, it&#8217;s all upto you to use it in a way that gets your job done. </p>
<p>PHP redirects being a server side script works on all browsers and you don&#8217;t have to worry about browser standards. Redirection is quick and distraction free as you&#8217;re not wasting time by showing them some demo page in between the redirection. In this tutorial we&#8217;re assuming that you&#8217;re creating redirection on your 404 page. You can use the following code to redirect search engines and users to homepage. </p>
<p><strong>Code</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location:http://yahoo.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>You can replace the yahoo with some other page of your site. You can also use specific 404 page or archive page which most of the websites use to redirect users. Archive page or sitemap pages are more useful as they let visitors make decision about where to visit next from the redirected page. </p>
<p><strong>Note:</strong> While running this php page make sure you&#8217;re not placing this code in < body > tag. Make this page purely php page without any other code in between and before or after the code. This should be the only code that needs to be executed in order for this example to work. If you&#8217;re using php designer 7 onwards then you may notice that redirection example may not work in the IDE. For some strange reasons it doesn&#8217;t work inside IDE. </p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/43/how-to-redirect-users-using-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Disable Right Click on Website</title>
		<link>http://helpfolder.com/38/how-to-disable-right-click-on-website</link>
		<comments>http://helpfolder.com/38/how-to-disable-right-click-on-website#comments</comments>
		<pubDate>Mon, 05 Dec 2011 21:26:23 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=38</guid>
		<description><![CDATA[Learn How to disable right click menu on any website in this tutorial. There are some people on the web who scrape your content and use it on their own website without taking permission. In such cases they don&#8217;t give credit to original author and also they don&#8217;t care who is the original source. Such [...]]]></description>
			<content:encoded><![CDATA[<p>Learn How to disable right click menu on any website in this tutorial. There are some people on the web who scrape your content and use it on their own website without taking permission. In such cases they don&#8217;t give credit to original author and also they don&#8217;t care who is the original source. <span id="more-38"></span>Such type of plagiarists are hard to deal with as they&#8217;re going to deny every form of communication to take down the content. In such a case you should consider protecting your content and feeds from such scrapers. </p>
<p>In this tutorial we&#8217;ll see how to disable the the right click browser specific menu. As this JavaScript is taken from <a href="http://www.dynamicdrive.com/dynamicindex9/noright3.htm">dynamic drive</a>, credit of this code snippet goes to renigade (dynamic drive). </p>
<p><strong>Disable Right Click on Static HTML Sites</strong></p>
<p>For static sites with limited web pages should add the following code inside the html page. Make sure you add this code before < / body > tag of the html page.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span>JavaScript<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;!--</span>
<span style="color: #003366; font-weight: bold;">var</span> message<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">///////////////////////////////////</span>
<span style="color: #003366; font-weight: bold;">function</span> clickIE<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">all</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>return <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> clickNS<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span> 
<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">layers</span><span style="color: #339933;">||</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #339933;">&amp;&amp;!</span>document.<span style="color: #660066;">all</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">which</span><span style="color: #339933;">==</span><span style="color: #CC0000;">2</span><span style="color: #339933;">||</span>e.<span style="color: #660066;">which</span><span style="color: #339933;">==</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#40;</span>message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>return <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">layers</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>document.<span style="color: #660066;">captureEvents</span><span style="color: #009900;">&#40;</span>Event.<span style="color: #660066;">MOUSEDOWN</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>document.<span style="color: #660066;">onmousedown</span><span style="color: #339933;">=</span>clickNS<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>document.<span style="color: #660066;">onmouseup</span><span style="color: #339933;">=</span>clickNS<span style="color: #339933;">;</span>document.<span style="color: #660066;">oncontextmenu</span><span style="color: #339933;">=</span>clickIE<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
document.<span style="color: #660066;">oncontextmenu</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> <span style="color: #003366; font-weight: bold;">Function</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;return false&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #006600; font-style: italic;">// --&gt; </span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p><strong>Disable Right Click on WordPress Blog</strong></p>
<p>In case of wordpress you can either edit header.php or footer.php of your theme OR you can use text widget in sidebar or footer to add this code. If you change theme, just add the widget back again to enable the script or else you can again modify the footer.php or header.php of theme.<br />
<div id="attachment_40" class="wp-caption aligncenter" style="width: 303px"><img src="http://helpfolder.com/wp-content/uploads/2011/12/Wordpress_Widget-293x300.jpg" alt="" title="Wordpress_Widget" width="293" height="300" class="size-medium wp-image-40" /><p class="wp-caption-text">Adding Javascript Code in Text Widget of WordPress</p></div></p>
<p><strong>Disable Right Click on Blogger Blog</strong></p>
<p>You can add HTML widget in sidebar and then add the above code. This will eliminate the need to updating the code if you change theme. This sidebar usually remains consistent even after theme changes so you&#8217;ll definitely benefit by adding the code in html widget. </p>
<p><strong>Tumblr, WordPress.com, Joomla and Drupal</strong></p>
<ul>
<li>WordPress.com allows you to use add TEXT widget in sidebar which you can use to add this javascript snippet. </li>
<li>Tumblr is an online CMS and in order to make the changes you have to edit the theme of tumblr. So after every theme changes you have to add this javascript snippet into theme. </li>
<li>Joomla and Drupal has theme and templates feature which you can use to edit the themes. Adding this javascript snippet in your theme is very easy if you&#8217;re already using such a complicated CMS like drupal (or joomla).</li>
</ul>
<p>If you&#8217;re using any other content management system like textpattern, expression engine etc. then you have to ask for help in respective community forums. </p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/38/how-to-disable-right-click-on-website/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Functions Tutorial</title>
		<link>http://helpfolder.com/34/php-functions-tutorial</link>
		<comments>http://helpfolder.com/34/php-functions-tutorial#comments</comments>
		<pubDate>Sat, 03 Dec 2011 18:44:30 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=34</guid>
		<description><![CDATA[A function is used in almost every programming language to reduce excessive code and for effective code re-usability. In some programming languages function is called as method. In almost every programming language they&#8217;re used to perform particular task on regular basis. This way it saves time of programmer and code also becomes more readable. In [...]]]></description>
			<content:encoded><![CDATA[<p>A function is used in almost every programming language to reduce excessive code and for effective code re-usability. In some programming languages function is called as method. In almost every programming language they&#8217;re used to perform particular task on regular basis. This way it saves time of programmer and code also becomes more readable. <span id="more-34"></span></p>
<p>In this tutorial we&#8217;re going to take a look at function syntax and various ways to use functions. </p>
<p><strong>Syntax</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> name_of_function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>You can follow camel-case convention for the function name. You can also use underscore for the function name but never start it with number or else compiler will flag error. </p>
<p>Keep these points in mind while writing functions -</p>
<ul>
<li>Start your function with the keyword function.</li>
<li>Function should be declared first before using in your program.</li>
<li>Make sure the function name is correctly used in a program.</li>
</ul>
<p><strong>How to Use PHP function</strong></p>
<p>We have already created our first function so let&#8217;s take a quick look at how we can use it in our program. One thing to note that you have to declare the function before you use it. You can also add the function by import function if you want in your program.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> hello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;hello&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;this is function demo&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br/&gt;&quot;</span><span style="color: #339933;">;</span>
hello<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>Parametrized Functions</strong></p>
<p>You can pass value to your functions from outside the functions. You can then use the value to process in your function or just use them to print out on web page.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
<span style="color: #000000; font-weight: bold;">function</span> apple<span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;no of apples are&quot;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$num</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;br/&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
apple<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>You can also process the value and show results back to the user.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> apple<span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000088;">$num</span><span style="color: #339933;">+=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;no of apples after adding 1 more in the basket :&quot;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$num</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;br/&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
apple<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>That&#8217;s it. You now know how to use functions in php. You can practice using functions with some demo programs. There are many home work assignments out there that you can see for more php function examples. Hope this helps you. Feel free to ask questions, suggest a feature, point errors. Don&#8217;t forget to bookmark or share this site in any social network site of your choice. </p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/34/php-functions-tutorial/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use HTML Forms With PHP</title>
		<link>http://helpfolder.com/32/how-to-use-html-forms-with-php</link>
		<comments>http://helpfolder.com/32/how-to-use-html-forms-with-php#comments</comments>
		<pubDate>Fri, 02 Dec 2011 19:06:19 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=32</guid>
		<description><![CDATA[Some HTML forms pass data from one page to another without the use of database. You can use php to enhance your HTML forms by making sure that these forms are processed properly. For example if you want some condition to be fulfilled before processing the form then it is possible to do so with [...]]]></description>
			<content:encoded><![CDATA[<p>Some HTML forms pass data from one page to another without the use of database. You can use php to enhance your HTML forms by making sure that these forms are processed properly. For example if you want some condition to be fulfilled before processing the form then it is possible to do so with php.<span id="more-32"></span> In this tutorial we&#8217;re going to process out data from one form to another static page by using php. </p>
<p>In this tutorial we&#8217;re going to create a page that passes two variables to another page via forms. Variables &#8220;toys&#8221; and &#8220;game&#8221; are the ones we&#8217;re going to pass.We&#8217;re going to add these in the form of attributes in the form. These two variables will be displaying a value that user selects in first page. Let&#8217;s create a simple HTML form with some options -</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;body&gt;
&lt;h3&gt;Select an Option&lt;/h4&gt;
&lt;form action=&quot;toys.php&quot; method=&quot;post&quot;&gt;
&lt;select name=&quot;game&quot;&gt;
&lt;option&gt;kite&lt;/option&gt;
&lt;option&gt;yo yo&lt;/option&gt;
&lt;option&gt;beyblade&lt;/option&gt;
&lt;/select&gt;
How many : &lt;input name=&quot;toys&quot; type=&quot;text&quot;/&gt;
&lt;input type=&quot;submit&quot;/&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>If you read the code carefully then you&#8217;ll notice that field name &#8220;game&#8221; and &#8220;toys&#8221; are going to be important here. As they&#8217;re the items that we&#8217;re going to pass to other page.<br />
<strong><br />
Code toys.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;body&gt;
&lt;?php 
$toys=$_post['toys'];
$game=$_post['game'];
echo &quot;You want&quot;.toys.&quot; &quot;.$game.&quot;;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>You can upload these two files on your webserver and execute it to see if they&#8217;re showing you the right output. You can test this on your own if you have xampp server on your desktop.</p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/32/how-to-use-html-forms-with-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use Include Function in PHP</title>
		<link>http://helpfolder.com/30/how-to-use-include-function-in-php</link>
		<comments>http://helpfolder.com/30/how-to-use-include-function-in-php#comments</comments>
		<pubDate>Thu, 01 Dec 2011 14:34:02 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=30</guid>
		<description><![CDATA[Sometimes you need to keep the same data across all pages. For example, take case of website that has common navigation menu, footer and sidebar across all pages. When you build a dynamic site it is important that these parts of a website remains common so that users can access website without any confusion. In [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you need to keep the same data across all pages. For example, take case of website that has common navigation menu, footer and sidebar across all pages. When you build a dynamic site it is important that these parts of a website remains common so that users can access website without any confusion. <span id="more-30"></span>In situations like this include function is very useful in any dynamic php based website.</p>
<p>Include function takes the specified file name and simply inserts the file contents into the script that calls it. As you get into situations where you want reuse the content over multiple pages, this function is going to very handy for you. </p>
<p><strong>Using Include Function</strong></p>
<p>Let&#8217;s take an example of sidebar where you&#8217;re showing recent posts of your site. You want it to be seen on every page. In a case you can use include function that points to the sidebar.php and so that every file that has this function will include the contents of this file. </p>
<p><strong>Code Sidebar.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;this is sidebar&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If you want to include this sidebar.php in index or home.php in order to show the text, you need to use include function. </p>
<p><strong>Code Home.php</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sidebar.php); ?&gt;</span>
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>It&#8217;ll show the text in sidebar.php file on this web page. It&#8217;s very easy. But what if you don&#8217;t have that file in existence or if you mistype the file name ? In such a case php will throw error on web page and then will continue to show the remaining part of the text. </p>
<p>If you want to check if the file if loaded before executing the page for user, you need to use another function called require. This function will do the same job like include function and will also check if the particular file which is requested exists in folder.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sidebar.php); ?&gt;</span>
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>If the file is not present in the folder, PHP will throw an error on web page and will not execute the rest of the code. This is helpful if you&#8217;re working with sensitive data or plugins or media files. It is good practice to use require function instead of include function as it ensures your website is working properly and helps you catch the errors easily. </p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/30/how-to-use-include-function-in-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use Arrays in PHP</title>
		<link>http://helpfolder.com/26/how-to-use-arrays-in-php</link>
		<comments>http://helpfolder.com/26/how-to-use-arrays-in-php#comments</comments>
		<pubDate>Tue, 29 Nov 2011 18:14:07 +0000</pubDate>
		<dc:creator>Mahesh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://helpfolder.com/?p=26</guid>
		<description><![CDATA[In programming, we represent our data in terms of variable. As variable holds single value of a particular data type. This is not enough when you want to represent more than one value of any variable and in such case you have to use array. Take a look at this code - &#60;?php $number=1; ?&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>In programming, we represent our data in terms of variable. As variable holds single value of a particular data type. This is not enough when you want to represent more than one value of any variable and in such case you have to use array. <span id="more-26"></span></p>
<p>Take a look at this code -</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$number</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>When you execute this php file on your web server you&#8217;re going see this output</p>
<p><code>1</code></p>
<p>Now when you work with arrays you get to work with multiple values in same variables. Take a look at this code :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$number</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'one'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'two'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'three'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'four'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'five'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'six'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'seven'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>After executing the above code you&#8217;ll see that it prints out -</p>
<p><code>one,two, three,four,five,six,seven</code></p>
<p><strong>Numerical Arrays</strong></p>
<p>In this type of array you can decide how many values you wish to keep in a variable. It starts from position 0 to the specified position in the bracket. For example $number[3] array is going to hold total four values in the variable.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$number</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'one'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$number</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'two'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$number</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'three'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$number</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'four'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$number</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p><strong>Associative Arrays</strong></p>
<p>This type of array allows you to have key-value pair inside array. When you&#8217;re dealing with the relative values then associative arrays are useful.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$population</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;Karakura&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">20000</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$population</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;soul society&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">45000</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$population</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;hell&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">6000000</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$population</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;soul society&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>As you can see from these two types of arrays that they can hold more values than variable. So if you&#8217;re going to write a program that deals with the multiple value of same type of variable then consider using variable. You can also use arrays when you wish to use key-pair type of values. Do remember that default position of numerical arrays start from position 0 and you have to keep that in mind when creating arrays of exact size. </p>
]]></content:encoded>
			<wfw:commentRss>http://helpfolder.com/26/how-to-use-arrays-in-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

