<?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>JaffnaCampus.com &#187; PHP Basic</title>
	<atom:link href="http://jaffnacampus.com/category/php/php-basic/feed/" rel="self" type="application/rss+xml" />
	<link>http://jaffnacampus.com</link>
	<description>Gateway to your IT potential</description>
	<lastBuildDate>Tue, 27 Sep 2011 13:57:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP $_POST Function</title>
		<link>http://jaffnacampus.com/php/php-basic/php-post-function/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-post-function/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:34:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP $_POST Function]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=315</guid>
		<description><![CDATA[The built-in $_POST function is used to collect values   in a form with   method=&#34;post&#34;.

The $_POST Function
The [...]]]></description>
			<content:encoded><![CDATA[<p>The built-in $_POST function is used to collect values   in a form with   method=&quot;post&quot;.</p>
<hr />
<h2>The $_POST Function</h2>
<p>The built-in $_POST function is used to collect values from a form   sent with   method=&quot;post&quot;.</p>
<p>Information sent from a form with the POST method is invisible to   others and   has no limits on the amount of information to send.</p>
<p><strong>Note:</strong> However, there is an 8 Mb max size for the POST method,   by default   (can be changed by setting the post_max_size in the php.ini file).</p>
<h3>Example</h3>
<table id="table1" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;form action=&quot;welcome.php&quot; method=&quot;post&quot;&gt;<br />
        Name: &lt;input type=&quot;text&quot; name=&quot;fname&quot; /&gt;<br />
        Age: &lt;input type=&quot;text&quot; name=&quot;age&quot; /&gt;<br />
        &lt;input type=&quot;submit&quot; /&gt;<br />
        &lt;/form&gt; </td>
</tr>
</tbody>
</table>
<p>When the user clicks the &quot;Submit&quot; button, the URL will look   like this:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> http://www.w3schools.com/welcome.php </td>
</tr>
</tbody>
</table>
<p>The &quot;welcome.php&quot; file can now use the $_POST function to collect   form data   (the names of the form fields will automatically be the keys in the   $_POST   array):</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> Welcome &lt;?php echo $_POST[&quot;fname&quot;]; ?&gt;!&lt;br /&gt;<br />
        You are &lt;?php echo $_POST[&quot;age&quot;]; ?&gt; years old.</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>When to use method=&quot;post&quot;?</h2>
<p>Information sent from a form with the POST method is invisible to   others and   has no limits on the amount of information to send.</p>
<p>However, because the variables are not displayed in the URL, it is   not   possible to bookmark the page.</p>
<hr />
<h2>The PHP $_REQUEST Function</h2>
<p>The PHP built-in $_REQUEST function contains the contents of both   $_GET, $_POST, and $_COOKIE.</p>
<p>The $_REQUEST function can be used to collect form data sent   with both the GET and POST methods.</p>
<h3>Example</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> Welcome &lt;?php echo $_REQUEST[&quot;fname&quot;]; ?&gt;!&lt;br /&gt;<br />
        You are &lt;?php echo $_REQUEST[&quot;age&quot;]; ?&gt; years old.</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-post-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP $_GET Function</title>
		<link>http://jaffnacampus.com/php/php-basic/php-get-function/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-get-function/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:32:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP $_GET Function]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=313</guid>
		<description><![CDATA[The built-in $_GET function is used to collect values   in a form with   method=&#34;get&#34;.

The $_GET Function
The [...]]]></description>
			<content:encoded><![CDATA[<p>The built-in $_GET function is used to collect values   in a form with   method=&quot;get&quot;.</p>
<hr />
<h2>The $_GET Function</h2>
<p>The built-in $_GET function is used to collect values from a form   sent with   method=&quot;get&quot;.</p>
<p>Information sent from a form with the GET method is visible to   everyone (it   will be displayed in the browser&#8217;s address bar) and has limits on the   amount of   information to send (max. 100 characters).</p>
<h3>Example</h3>
<table id="table1" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;form action=&quot;welcome.php&quot; method=&quot;get&quot;&gt;<br />
        Name: &lt;input type=&quot;text&quot; name=&quot;fname&quot; /&gt;<br />
        Age: &lt;input type=&quot;text&quot; name=&quot;age&quot; /&gt;<br />
        &lt;input type=&quot;submit&quot; /&gt;<br />
        &lt;/form&gt; </td>
</tr>
</tbody>
</table>
<p>When the user clicks the &quot;Submit&quot; button, the URL sent to the   server could look something   like this:</p>
<table id="table2" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> http://www.w3schools.com/welcome.php?fname=Peter&amp;age=37 </td>
</tr>
</tbody>
</table>
<p>The &quot;welcome.php&quot; file can now use the $_GET function to collect form   data   (the names of the form fields will automatically be the keys in the   $_GET   array):</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> Welcome &lt;?php echo $_GET[&quot;fname&quot;]; ?&gt;.&lt;br /&gt;<br />
        You are &lt;?php echo $_GET[&quot;age&quot;]; ?&gt; years old! </td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>When to use method=&quot;get&quot;?</h2>
<p>When using method=&quot;get&quot; in HTML forms, all variable names and values   are displayed in the URL.</p>
<p><strong>Note:</strong> This method should not be used when sending passwords or   other sensitive information!</p>
<p>However, because the variables are displayed in the URL, it is   possible to   bookmark the page. This can be useful in some cases.</p>
<p><strong>Note:</strong> The get method is not suitable for large variable   values;   the value cannot exceed 100 characters.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-get-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Forms and User Input</title>
		<link>http://jaffnacampus.com/php/php-basic/php-forms-and-user-input/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-forms-and-user-input/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:31:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP Forms and User Input]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=311</guid>
		<description><![CDATA[The PHP $_GET and $_POST variables are used to retrieve   information from forms, like user input.

PHP Form Handling
The [...]]]></description>
			<content:encoded><![CDATA[<p>The PHP $_GET and $_POST variables are used to retrieve   information from forms, like user input.</p>
<hr />
<h2>PHP Form Handling</h2>
<p>The most important thing to notice when dealing with HTML forms and   PHP is   that any form element in an HTML page will <strong>automatically</strong> be   available to your PHP scripts.</p>
<h3>Example</h3>
<p>The example below contains an HTML form with two input fields and a   submit   button:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;form action=&quot;welcome.php&quot; method=&quot;post&quot;&gt;<br />
        Name: &lt;input type=&quot;text&quot; name=&quot;fname&quot; /&gt;<br />
        Age: &lt;input type=&quot;text&quot; name=&quot;age&quot; /&gt;<br />
        &lt;input type=&quot;submit&quot; /&gt;<br />
        &lt;/form&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>When a user fills out the form above and click on the submit button,   the form data   is sent to a PHP file, called &quot;welcome.php&quot;:</p>
<p>&quot;welcome.php&quot; looks like this:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        Welcome &lt;?php echo $_POST[&quot;fname&quot;]; ?&gt;!&lt;br /&gt;<br />
        You are &lt;?php echo $_POST[&quot;age&quot;]; ?&gt; years old.</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output could be something like this:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> Welcome John!<br />
        You are 28 years old.</td>
</tr>
</tbody>
</table>
<p>The PHP $_GET and $_POST functions will be explained in the next   chapters.</p>
<hr />
<h2>Form Validation</h2>
<p>User input should be validated on the browser whenever possible (by   client   scripts). Browser validation is faster and reduces the server load.</p>
<p>You should consider server validation if the user input will be   inserted into   a database. A good way to validate a form on the server is to post the   form to   itself, instead of jumping to a different page. The user will then get   the error   messages on the same page as the form. This makes it easier to discover   the   error.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-forms-and-user-input/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Functions</title>
		<link>http://jaffnacampus.com/php/php-basic/php-functions/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-functions/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:30:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=309</guid>
		<description><![CDATA[The real power of PHP comes from its functions.
In PHP, there are more than 700 built-in functions.

PHP Functions
In this chapter [...]]]></description>
			<content:encoded><![CDATA[<p>The real power of PHP comes from its functions.</p>
<p>In PHP, there are more than 700 built-in functions.</p>
<hr />
<h2>PHP Functions</h2>
<p>In this chapter we will show you how to create your own functions.</p>
<p>To keep the browser from executing a script when the page loads, you   can put   your script into a function.</p>
<p>A function will be executed by a call to the function.</p>
<p>You may call a function from anywhere within a page.</p>
<hr />
<h2>Create a PHP Function</h2>
<p>A function will be executed by a call to the function.</p>
<h3>Syntax</h3>
<table id="table1" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> function <em>functionName</em>()<br />
        {<br />
        <em>code to be executed</em>;<br />
        }</td>
</tr>
</tbody>
</table>
<p>PHP function guidelines:</p>
<ul>
<li>Give the function a name that reflects what the   	function does</li>
<li>The function name can start with a letter or   	underscore (not a number)</li>
</ul>
<h3>Example</h3>
<p>A simple function that writes my name when it is called:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        function writeName()<br />
        {<br />
        echo &quot;Kai Jim Refsnes&quot;;<br />
        }</p>
<p>        echo &quot;My name is &quot;;<br />
        writeName();<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> My name is Kai Jim Refsnes</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>PHP Functions &#8211; Adding parameters</h2>
<p>To add more functionality to a function, we can add parameters. A   parameter is just like a variable.</p>
<p>Parameters are specified after the function name, inside the   parentheses.</p>
<h3>Example 1</h3>
<p>The following example will write different first names, but equal   last   name:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        function writeName($fname)<br />
        {<br />
        echo $fname . &quot; Refsnes.&lt;br /&gt;&quot;;<br />
        }</p>
<p>        echo &quot;My name is &quot;;<br />
        writeName(&quot;Kai Jim&quot;);<br />
        echo &quot;My sister&#8217;s name is &quot;;<br />
        writeName(&quot;Hege&quot;);<br />
        echo &quot;My brother&#8217;s name is &quot;;<br />
        writeName(&quot;Stale&quot;);<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> My name is Kai Jim Refsnes.<br />
        My sister&#8217;s name is Hege Refsnes.<br />
        My brother&#8217;s name is Stale Refsnes. </td>
</tr>
</tbody>
</table>
<h3>Example 2</h3>
<p>The following function has two parameters:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        function writeName($fname,$punctuation)<br />
        {<br />
        echo $fname . &quot; Refsnes&quot; . $punctuation . &quot;&lt;br /&gt;&quot;;<br />
        }</p>
<p>        echo &quot;My name is &quot;;<br />
        writeName(&quot;Kai Jim&quot;,&quot;.&quot;);<br />
        echo &quot;My sister&#8217;s name is &quot;;<br />
        writeName(&quot;Hege&quot;,&quot;!&quot;);<br />
        echo &quot;My brother&#8217;s name is &quot;;<br />
        writeName(&quot;Ståle&quot;,&quot;?&quot;);<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> My name is Kai Jim Refsnes.<br />
        My sister&#8217;s name is Hege Refsnes!<br />
        My brother&#8217;s name is Ståle Refsnes? </td>
</tr>
</tbody>
</table>
<p> </p>
<hr />
<h2>PHP Functions &#8211; Return values</h2>
<p>To let a function return a value, use the return   statement.</p>
<h3>Example</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        function add($x,$y)<br />
        {<br />
        $total=$x+$y;<br />
        return $total;<br />
        }</p>
<p>        echo &quot;1 + 16 = &quot; . add(1,16);<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> 1 + 16 = 17</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Looping &#8211; For Loops</title>
		<link>http://jaffnacampus.com/php/php-basic/php-looping-for-loops/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-looping-for-loops/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:28:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP Looping - For Loops]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=307</guid>
		<description><![CDATA[Loops execute a block of code a specified number of   times, or   while a specified condition [...]]]></description>
			<content:encoded><![CDATA[<p>Loops execute a block of code a specified number of   times, or   while a specified condition is true.</p>
<hr />
<h2>The for Loop</h2>
<p>The for loop is used when you know in advance how many times the   script   should run.</p>
<h3>Syntax</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> for (<em>init; condition; increment</em>)<br />
        {<br />
        <em>code to be executed;</em><br />
        } </td>
</tr>
</tbody>
</table>
<p>Parameters:</p>
<ul>
<li><em>init</em>: Mostly used to set a counter (but can be any code to   be executed once at the beginning of the loop)</li>
<li><em>condition</em>: Evaluated for each loop iteration. If it   evaluates to TRUE, the loop continues. If it evaluates to FALSE, the   loop ends.</li>
<li><em>increment</em>: Mostly used to increment a counter (but can be   any code to be executed at the end of   	the loop)</li>
</ul>
<p><strong>Note: </strong>Each of the parameters above can be empty, or have   multiple expressions   (separated by commas).</p>
<h3>Example</h3>
<p>The example below defines a loop that starts with i=1. The loop will   continue   to run as long as i is less than, or equal to 5. i will increase by 1   each time   the loop runs:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        for ($i=1; $i&lt;=5; $i++)<br />
        {<br />
        echo &quot;The number is &quot; . $i . &quot;&lt;br /&gt;&quot;;<br />
        }<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output:</p>
<table id="table1" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> The number is 1<br />
        The number is 2<br />
        The number is 3<br />
        The number is 4<br />
        The number is 5</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>The foreach Loop</h2>
<p>The foreach loop is used to loop through arrays.</p>
<h3>Syntax</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> foreach ($<em>array </em>as$<em>value</em>)<br />
        {<br />
        <em>code to be executed;</em><br />
        } </td>
</tr>
</tbody>
</table>
<p>For every loop iteration, the value of the   current array element is assigned to $value (and the array pointer is   moved by one) &#8211;   so on the next loop iteration, you&#8217;ll be looking at the next array   value.</p>
<h3>Example</h3>
<p>The following example demonstrates a loop that will print the values   of    the given array:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        $x=array(&quot;one&quot;,&quot;two&quot;,&quot;three&quot;);<br />
        foreach ($x as $value)<br />
        {<br />
        echo $value . &quot;&lt;br /&gt;&quot;;<br />
        }<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output:</p>
<table id="table2" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> one<br />
        two<br />
        three</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-looping-for-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Looping &#8211; While Loops</title>
		<link>http://jaffnacampus.com/php/php-basic/php-looping-while-loops/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-looping-while-loops/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:26:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP Looping - While Loops]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=304</guid>
		<description><![CDATA[Loops execute a block of code a specified number of   times, or while a specified condition is true.

PHP [...]]]></description>
			<content:encoded><![CDATA[<p>Loops execute a block of code a specified number of   times, or while a specified condition is true.</p>
<hr />
<h2>PHP Loops</h2>
<p>Often when you write code, you want the same block of code to run   over and   over again in a row. Instead of adding several almost equal lines in a   script we   can use loops to perform a task like this.</p>
<p>In PHP, we have the following looping statements:</p>
<ul>
<li><strong>while </strong>- loops through a block of code while a specified   condition is true</li>
<li><strong>do&#8230;while</strong> &#8211; loops through a block of code once, and then   repeats the loop     as long as a specified condition is true</li>
<li><strong>for </strong>- loops through a block of code a specified number of   times</li>
<li><strong>foreach </strong>- loops through a block of code for each element in   an     array</li>
</ul>
<hr />
<h2>The while Loop</h2>
<p>The while loop executes a block of code while a condition is true.</p>
<h3>Syntax</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> while (<em>condition</em>)<br />
        {<br />
        <em>  code to be executed</em>;<br />
        }</td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The example below defines a loop that starts with i=1. The loop will   continue   to run as long as i is less than, or equal to 5. i will increase by 1   each time   the loop runs:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        $i=1;<br />
        while($i&lt;=5)<br />
        {<br />
        echo &quot;The number is &quot; . $i . &quot;&lt;br /&gt;&quot;;<br />
        $i++;<br />
        }<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output:</p>
<table id="table1" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> The number is 1<br />
        The number is 2<br />
        The number is 3<br />
        The number is 4<br />
        The number is 5</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>The do&#8230;while Statement</h2>
<p>The do&#8230;while statement will always execute the block of code once,   it   will then check the condition, and   repeat the loop while the condition is true.</p>
<h3>Syntax</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> do<br />
        {<br />
        <em>  code to be executed;<br />
        </em>}<br />
        while (<em>condition</em>); </td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The example below defines a loop that starts with i=1. It will then   increment   i with 1, and write some output. Then the condition is checked, and the   loop   will continue to run as long as i is less than, or equal to 5:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        $i=1;<br />
        do<br />
        {<br />
        $i++;<br />
        echo &quot;The number is &quot; . $i . &quot;&lt;br /&gt;&quot;;<br />
        }<br />
        while ($i&lt;=5);<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Output:</p>
<table id="table2" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> The number is 2<br />
        The number is 3<br />
        The number is 4<br />
        The number is 5<br />
        The number is 6</td>
</tr>
</tbody>
</table>
<p>The for loop and the foreach loop will be explained in the next   chapter.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-looping-while-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Arrays</title>
		<link>http://jaffnacampus.com/php/php-basic/php-arrays/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-arrays/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:25:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP Arrays]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=302</guid>
		<description><![CDATA[An array stores multiple values in one single variable.

What is an Array?
A variable is a storage area holding a number [...]]]></description>
			<content:encoded><![CDATA[<p>An array stores multiple values in one single variable.</p>
<hr />
<h2>What is an Array?</h2>
<p>A variable is a storage area holding a number or   text. The problem is, a variable will hold only one value.</p>
<p>An array is a special variable, which can store multiple values in   one single   variable.</p>
<p>If you have a list of items (a list of car names, for example),   storing the cars   in single variables could look like this:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> $cars1=&quot;Saab&quot;;<br />
        $cars2=&quot;Volvo&quot;;<br />
        $cars3=&quot;BMW&quot;; </td>
</tr>
</tbody>
</table>
<p>However, what if you want to loop through the cars and find a   specific one? And what if you had not 3 cars, but 300?</p>
<p>The best solution here is to use an array!</p>
<p>An array can hold all your variable values under a single name. And   you can access the values by referring to the array name.</p>
<p>Each element in the array has its own index so that it can be easily   accessed.</p>
<p>In PHP, there are three kind of arrays:</p>
<ul>
<li><strong>Numeric array</strong> &#8211; An array with a numeric index</li>
<li><strong>Associative array</strong> &#8211; An array where each ID key is   associated with a value</li>
<li><strong>Multidimensional array</strong> &#8211; An array containing one or more   arrays</li>
</ul>
<hr />
<h2>Numeric Arrays</h2>
<p>A numeric array stores each array element with a numeric index.</p>
<p>There are two methods to create a numeric array.</p>
<p>1. In the following example the index are automatically assigned (the   index   starts at 0):</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> $cars=array(&quot;Saab&quot;,&quot;Volvo&quot;,&quot;BMW&quot;,&quot;Toyota&quot;); </td>
</tr>
</tbody>
</table>
<p>2. In the following example we assign the index manually:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> $cars[0]=&quot;Saab&quot;;<br />
        $cars[1]=&quot;Volvo&quot;;<br />
        $cars[2]=&quot;BMW&quot;;<br />
        $cars[3]=&quot;Toyota&quot;; </td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>In the following example you access the variable values by referring   to the   array name and index:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;?php<br />
        $cars[0]=&quot;Saab&quot;;<br />
        $cars[1]=&quot;Volvo&quot;;<br />
        $cars[2]=&quot;BMW&quot;;<br />
        $cars[3]=&quot;Toyota&quot;; <br />
        echo $cars[0] . &quot; and &quot; . $cars[1] . &quot; are Swedish cars.&quot;;<br />
        ?&gt;</td>
</tr>
</tbody>
</table>
<p>The code above will output:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>Saab and Volvo are Swedish cars.</td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>Associative Arrays</h2>
<p>An associative array, each ID key is associated with a value.</p>
<p>When storing data about specific named values, a numerical array is   not   always the best way to do it.</p>
<p>With associative arrays we can use the values as keys and assign   values   to them.</p>
<h3>Example 1</h3>
<p>In this example we use an array to assign ages to the different   persons:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> $ages = array(&quot;Peter&quot;=&gt;32, &quot;Quagmire&quot;=&gt;30, &quot;Joe&quot;=&gt;34); </td>
</tr>
</tbody>
</table>
<h3>Example 2</h3>
<p>This example is the same as example 1, but shows a different way of   creating the array:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> $ages['Peter'] = &quot;32&quot;;<br />
        $ages['Quagmire'] = &quot;30&quot;;<br />
        $ages['Joe'] = &quot;34&quot;; </td>
</tr>
</tbody>
</table>
<p>The ID keys can be used in a script:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;?php<br />
        $ages['Peter'] = &quot;32&quot;;<br />
        $ages['Quagmire'] = &quot;30&quot;;<br />
        $ages['Joe'] = &quot;34&quot;;</p>
<p>        echo &quot;Peter is &quot; . $ages['Peter'] . &quot; years old.&quot;;<br />
        ?&gt; </td>
</tr>
</tbody>
</table>
<p>The code above will output:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> Peter is 32 years old. </td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>Multidimensional Arrays</h2>
<p>In a multidimensional array, each element in the main array can also   be an array.   And each element in the sub-array can be an array, and so on.</p>
<h3>Example</h3>
<p>In this example we create a multidimensional array, with   automatically   assigned ID keys:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> $families = array<br />
        (<br />
        &quot;Griffin&quot;=&gt;array<br />
        (<br />
        &quot;Peter&quot;,<br />
        &quot;Lois&quot;,<br />
        &quot;Megan&quot;<br />
        ),<br />
        &quot;Quagmire&quot;=&gt;array<br />
        (<br />
        &quot;Glenn&quot;<br />
        ),<br />
        &quot;Brown&quot;=&gt;array<br />
        (<br />
        &quot;Cleveland&quot;,<br />
        &quot;Loretta&quot;,<br />
        &quot;Junior&quot;<br />
        )<br />
        ); </td>
</tr>
</tbody>
</table>
<p>The array above would look like this if written to the output:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> Array<br />
        (<br />
        [Griffin] =&gt; Array<br />
        (<br />
        [0] =&gt; Peter<br />
        [1] =&gt; Lois<br />
        [2] =&gt; Megan<br />
        )<br />
        [Quagmire] =&gt; Array<br />
        (<br />
        [0] =&gt; Glenn<br />
        )<br />
        [Brown] =&gt; Array<br />
        (<br />
        [0] =&gt; Cleveland<br />
        [1] =&gt; Loretta<br />
        [2] =&gt; Junior<br />
        )<br />
        ) </td>
</tr>
</tbody>
</table>
<h3>Example 2</h3>
<p>Lets try displaying a single value from the array above:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> echo &quot;Is &quot; . $families['Griffin'][2] . <br />
        &quot; a part of the Griffin family?&quot;; </td>
</tr>
</tbody>
</table>
<p>The code above will output:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> Is Megan a part of the Griffin family? </td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Switch Statement</title>
		<link>http://jaffnacampus.com/php/php-basic/php-switch-statement/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-switch-statement/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:24:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP Switch Statement]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=300</guid>
		<description><![CDATA[Conditional statements are used to perform different   actions based on different conditions.

The PHP Switch Statement
Use the switch statement [...]]]></description>
			<content:encoded><![CDATA[<p>Conditional statements are used to perform different   actions based on different conditions.</p>
<hr />
<h2>The PHP Switch Statement</h2>
<p>Use the switch statement to select one of many blocks   of code to be executed.</p>
<h3>Syntax</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> switch (<em>n</em>)<br />
        {<br />
        case <em>label1:</em><br />
        <em>code to be executed if n=label1;</em><br />
        break;<br />
        case <em>label2:</em><br />
        <em>code to be executed if n=label2;</em><br />
        break;<br />
        default:<br />
        <em>code to be executed if n is different from both label1 and label2;</em><br />
        } </td>
</tr>
</tbody>
</table>
<p>This is how it works: First we have a single expression <em>n</em> (most often a  variable), that is evaluated once. The value of the expression is then   compared  with the values for each case in the structure. If there is a match, the   block  of code associated with that case is executed. Use <strong>break</strong> to   prevent the  code from running into the next case automatically. The default   statement is used if no   match is found.</p>
<h3>Example</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        switch ($x)<br />
        {<br />
        case 1:<br />
        echo &quot;Number 1&quot;;<br />
        break;<br />
        case 2:<br />
        echo &quot;Number 2&quot;;<br />
        break;<br />
        case 3:<br />
        echo &quot;Number 3&quot;;<br />
        break;<br />
        default:<br />
        echo &quot;No number between 1 and 3&quot;;<br />
        }<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-switch-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP If&#8230;Else Statements</title>
		<link>http://jaffnacampus.com/php/php-basic/php-if-else-statements/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-if-else-statements/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:22:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP If...Else Statements]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/?p=298</guid>
		<description><![CDATA[Conditional statements are used to perform different   actions based on different conditions.

Conditional Statements
Very often when you write code, [...]]]></description>
			<content:encoded><![CDATA[<p>Conditional statements are used to perform different   actions based on different conditions.</p>
<hr />
<h2>Conditional Statements</h2>
<p>Very often when you write code, you want to perform different actions   for   different decisions. </p>
<p>You can use conditional statements in your code to do this.</p>
<p>In PHP we have the following conditional statements:</p>
<ul>
<li><strong>if statement</strong> &#8211; use this statement to execute some code only   if a specified condition is true</li>
<li><strong>if&#8230;else statement</strong> &#8211; use this statement to execute some   code if a condition is true and another   	code if the condition is false</li>
<li><strong>if&#8230;elseif&#8230;.else statement</strong> &#8211; use this statement to   select one of   	several blocks of code to be executed</li>
<li><strong>switch statement</strong> &#8211; use this statement to select one of many   blocks of code to be executed</li>
</ul>
<hr />
<h2>The if Statement</h2>
<p>Use the if statement to execute some code only if a specified   condition is true.</p>
<h3>Syntax</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>if (<em>condition</em>) <em>code to be executed if condition   is true;</em></td>
</tr>
</tbody>
</table>
<p>The following example will output &quot;Have a nice weekend!&quot; if the   current day   is Friday:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        $d=date(&quot;D&quot;);<br />
        if ($d==&quot;Fri&quot;) echo &quot;Have a nice weekend!&quot;;<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>Notice that there is no ..else.. in this syntax. You tell the browser   to execute some code <strong>only if the specified condition is true</strong>.</p>
<hr />
<h2>The if&#8230;else Statement</h2>
<p>Use the if&#8230;.else statement to execute some code if a condition is   true and another code if a   condition is false.</p>
<h3>Syntax</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> if (<em>condition</em>)<br />
        <em>code to be executed if condition is true;</em><br />
        else<br />
        <em>code to be executed if condition is false;</em></td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The following example will output &quot;Have a nice weekend!&quot; if the   current day   is Friday, otherwise it will output &quot;Have a nice day!&quot;:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        $d=date(&quot;D&quot;);<br />
        if ($d==&quot;Fri&quot;)<br />
        echo &quot;Have a nice weekend!&quot;;<br />
        else<br />
        echo &quot;Have a nice day!&quot;;<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p>If more than one line should be executed if a condition is   true/false, the   lines should be enclosed within curly braces:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        $d=date(&quot;D&quot;);<br />
        if ($d==&quot;Fri&quot;)<br />
        {<br />
        echo &quot;Hello!&lt;br /&gt;&quot;;<br />
        echo &quot;Have a nice weekend!&quot;;<br />
        echo &quot;See you on Monday!&quot;;<br />
        }<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
<p></p>
<hr />
<h2>The <strong>if&#8230;elseif&#8230;.else</strong> Statement</h2>
<p>Use the if&#8230;.elseif&#8230;else statement to select one of several blocks   of code to be executed.</p>
<h3>Syntax</h3>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td> if (<em>condition</em>)<br />
        <em>code to be executed if condition is true;</em><br />
        elseif (<em>condition</em>)<br />
        <em>code to be executed if condition is true;<br />
        </em>else<br />
        <em>code to be executed if condition is false;</em></td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The following example will output &quot;Have a nice weekend!&quot; if the   current day   is Friday, and &quot;Have a nice Sunday!&quot; if the current day is Sunday.   Otherwise it will output &quot;Have a nice day!&quot;:</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>&lt;html&gt;<br />
        &lt;body&gt;</p>
<p>        &lt;?php<br />
        $d=date(&quot;D&quot;);<br />
        if ($d==&quot;Fri&quot;)<br />
        echo &quot;Have a nice weekend!&quot;;<br />
        elseif ($d==&quot;Sun&quot;)<br />
        echo &quot;Have a nice Sunday!&quot;;<br />
        else<br />
        echo &quot;Have a nice day!&quot;;<br />
        ?&gt;</p>
<p>        &lt;/body&gt;<br />
        &lt;/html&gt; </td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-if-else-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Operators</title>
		<link>http://jaffnacampus.com/php/php-basic/php-operators/</link>
		<comments>http://jaffnacampus.com/php/php-basic/php-operators/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 04:21:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP Basic]]></category>
		<category><![CDATA[PHP Operators]]></category>

		<guid isPermaLink="false">http://jaffnacampus.com/php/php-basic/php-operators/</guid>
		<description><![CDATA[Operators are used to operate on values.

PHP Operators
This section lists the different operators used in PHP.
Arithmetic Operators



Operator
Description
Example
Result


+
Addition
x=2
    [...]]]></description>
			<content:encoded><![CDATA[<p>Operators are used to operate on values.</p>
<hr />
<h2>PHP Operators</h2>
<p>This section lists the different operators used in PHP.</p>
<p><strong>Arithmetic Operators</strong></p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left" width="15%">Operator</th>
<th align="left" width="40%">Description</th>
<th align="left" width="25%">Example</th>
<th align="left" width="20%">Result</th>
</tr>
<tr>
<td valign="top">+</td>
<td valign="top">Addition</td>
<td valign="top">x=2<br />
        x+2</td>
<td valign="top">4</td>
</tr>
<tr>
<td valign="top">-</td>
<td valign="top">Subtraction</td>
<td valign="top">x=2<br />
        5-x</td>
<td valign="top">3</td>
</tr>
<tr>
<td valign="top">*</td>
<td valign="top">Multiplication</td>
<td valign="top">x=4<br />
        x*5</td>
<td valign="top">20</td>
</tr>
<tr>
<td valign="top">/</td>
<td valign="top">Division</td>
<td valign="top">15/5<br />
        5/2</td>
<td valign="top">3<br />
        2.5</td>
</tr>
<tr>
<td valign="top">%</td>
<td valign="top">Modulus (division remainder)</td>
<td valign="top">5%2<br />
        10%8<br />
        10%2</td>
<td valign="top">1<br />
        2<br />
        0</td>
</tr>
<tr>
<td valign="top">++</td>
<td valign="top">Increment</td>
<td valign="top">x=5<br />
        x++</td>
<td valign="top">x=6</td>
</tr>
<tr>
<td valign="top">&#8211;</td>
<td valign="top">Decrement</td>
<td valign="top">x=5<br />
        x&#8211;</td>
<td valign="top">x=4</td>
</tr>
</tbody>
</table>
<p><strong>Assignment Operators</strong></p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left" width="15%">Operator</th>
<th align="left" width="40%">Example</th>
<th align="left" width="45%">Is The Same As</th>
</tr>
<tr>
<td valign="top">=</td>
<td valign="top">x=y</td>
<td valign="top">x=y</td>
</tr>
<tr>
<td valign="top">+=</td>
<td valign="top">x+=y</td>
<td valign="top">x=x+y</td>
</tr>
<tr>
<td valign="top">-=</td>
<td valign="top">x-=y</td>
<td valign="top">x=x-y</td>
</tr>
<tr>
<td valign="top">*=</td>
<td valign="top">x*=y</td>
<td valign="top">x=x*y</td>
</tr>
<tr>
<td valign="top">/=</td>
<td valign="top">x/=y</td>
<td valign="top">x=x/y</td>
</tr>
<tr>
<td valign="top">.=</td>
<td valign="top">x.=y</td>
<td valign="top">x=x.y</td>
</tr>
<tr>
<td valign="top">%=</td>
<td valign="top">x%=y</td>
<td valign="top">x=x%y</td>
</tr>
</tbody>
</table>
<p><strong>Comparison Operators</strong></p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left" width="15%">Operator</th>
<th align="left" width="40%">Description</th>
<th align="left" width="45%">Example</th>
</tr>
<tr>
<td valign="top">==</td>
<td valign="top">is equal to</td>
<td valign="top">5==8 returns false</td>
</tr>
<tr>
<td valign="top">!=</td>
<td valign="top">is not equal</td>
<td valign="top">5!=8 returns true</td>
</tr>
<tr>
<td valign="top">&lt;&gt;</td>
<td valign="top">is not equal</td>
<td valign="top">5&lt;&gt;8 returns true</td>
</tr>
<tr>
<td valign="top">&gt;</td>
<td valign="top">is greater than</td>
<td valign="top">5&gt;8 returns false</td>
</tr>
<tr>
<td valign="top">&lt;</td>
<td valign="top">is less than</td>
<td valign="top">5&lt;8 returns true</td>
</tr>
<tr>
<td valign="top">&gt;=</td>
<td valign="top">is greater than or equal to</td>
<td valign="top">5&gt;=8 returns false</td>
</tr>
<tr>
<td valign="top">&lt;=</td>
<td valign="top">is less than or equal to</td>
<td valign="top">5&lt;=8 returns true</td>
</tr>
</tbody>
</table>
<p><strong>Logical Operators</strong></p>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<th align="left" width="15%">Operator</th>
<th align="left" width="40%">Description</th>
<th align="left" width="45%">Example</th>
</tr>
<tr>
<td valign="top">&amp;&amp;</td>
<td valign="top">and</td>
<td valign="top"> x=6<br />
        y=3</p>
<p>(x &lt; 10 &amp;&amp; y &gt; 1) returns true</p>
</td>
</tr>
<tr>
<td valign="top">||</td>
<td valign="top">or</td>
<td valign="top"> x=6<br />
        y=3</p>
<p>(x==5 || y==5) returns false</p>
</td>
</tr>
<tr>
<td valign="top">!</td>
<td valign="top">not</td>
<td valign="top"> x=6<br />
        y=3</p>
<p>!(x==y) returns true</p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://jaffnacampus.com/php/php-basic/php-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

