<?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>Cindra Onggo</title>
	<atom:link href="http://blog.uad.ac.id/onggo/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.uad.ac.id/onggo</link>
	<description>oh yeah... lock and load'</description>
	<lastBuildDate>Thu, 27 Nov 2008 03:00:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The foreach Statement</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/27/the-foreach-statement/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/27/the-foreach-statement/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 03:00:23 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/?p=140</guid>
		<description><![CDATA[The foreach statement is used to loop through arrays.
For every loop, 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, you&#8217;ll be looking at the next element.
Syntax




foreach (array as value)
{
    code to be executed;
}




Example
The [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The foreach statement is used to loop through arrays.</p>
<p>For every loop, 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, you&#8217;ll be looking at the next element.</p>
<h3>Syntax</h3>
<table class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>foreach (<em>array </em>as<em> value</em>)
{
    <em>code to be executed;</em>
}</pre>
</td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The following example demonstrates a loop that will print the values of   the given array:</p>
<table class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;html&gt;
&lt;body&gt;</pre>
<pre>&lt;?php
$arr=array("one", "two", "three");</pre>
<pre>foreach ($arr as $value)
{
  echo "Value: " . $value . "&lt;br /&gt;";
}
?&gt;</pre>
<pre>&lt;/body&gt;
&lt;/html&gt;</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/27/the-foreach-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The do&#8230;while Statement</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/27/the-dowhile-statement/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/27/the-dowhile-statement/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 02:51:06 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/?p=137</guid>
		<description><![CDATA[The do&#8230;while statement will execute a block of code at least once &#8211; it  then will  repeat the loop as long as a condition is true.
Syntax




do
{
code to be executed;
}
while (condition);




Example
The  following example will increment the value of i at least once, and it will  continue incrementing the variable i as long [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The do&#8230;while statement will execute a block of code <strong>at least once</strong> &#8211; it  then will  repeat the loop <strong>as long as</strong> a condition is true.</p>
<h3>Syntax</h3>
<table class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>do
{
<em>code to be executed;
</em>}
while (<em>condition</em>);</pre>
</td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The  following example will increment the value of i at least once, and it will  continue incrementing the variable i as long as it has a value of less than 5:</p>
<table class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;html&gt;
&lt;body&gt;</pre>
<pre>&lt;?php
$i=0;
do
  {
  $i++;
  echo "The number is " . $i . "&lt;br /&gt;";
  }
while ($i&lt;5);
?&gt;</pre>
<pre>&lt;/body&gt;
&lt;/html&gt;</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/27/the-dowhile-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The while Statement</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/18/the-while-statement/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/18/the-while-statement/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 06:09:06 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/?p=135</guid>
		<description><![CDATA[The while statement will execute a block of code if and as long as a condition is true.
Syntax




while (condition)
code to be executed;




Example
The  following example demonstrates a loop that will continue to run as long as the  variable i is  less than, or equal to 5. i will increase by 1 each time [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The while statement will execute a block of code <strong>if and as long as</strong> a condition is true.</p>
<h3>Syntax</h3>
<table class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>while (<em>condition</em>)
<em>code to be executed</em>;</pre>
</td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The  following example demonstrates a loop that will continue to run as long as the  variable i is  less than, or equal to 5. i will increase by 1 each time the loop runs:</p>
<table class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;html&gt;
&lt;body&gt;</pre>
<pre>&lt;?php
$i=1;
while($i&lt;=5)
  {
  echo "The number is " . $i . "&lt;br /&gt;";
  $i++;
  }
?&gt;</pre>
<pre>&lt;/body&gt;
&lt;/html&gt;</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/18/the-while-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Looping</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/18/looping/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/18/looping/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 06:06:23 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/?p=133</guid>
		<description><![CDATA[Very often when you write code, you want the same block of code to run a number of times. You can use looping statements in your code to perform this.
In PHP we have the following looping statements:
    * while &#8211; loops through a block of code if and as long as a [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Very often when you write code, you want the same block of code to run a number of times. You can use looping statements in your code to perform this.</p>
<p>In PHP we have the following looping statements:</p>
<p>    * while &#8211; loops through a block of code if and as long as a specified condition is true<br />
    * do&#8230;while &#8211; loops through a block of code once, and then repeats the loop as long as a special condition is true<br />
    * for &#8211; loops through a block of code a specified number of times<br />
    * foreach &#8211; loops through a block of code for each element in an array</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/18/looping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multidimensional Arrays</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/18/multidimensional-arrays/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/18/multidimensional-arrays/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 06:04:32 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/?p=131</guid>
		<description><![CDATA[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.
Example
In this example we create a multidimensional array, with automatically  assigned ID keys:




$families = array
(
  "Griffin"=&#62;array
  (
  "Peter",
  "Lois",
  "Megan"
  [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<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 id="table18" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>$families = array
(
  "Griffin"=&gt;array
  (
  "Peter",
  "Lois",
  "Megan"
  ),
  "Quagmire"=&gt;array
  (
  "Glenn"
  ),
  "Brown"=&gt;array
  (
  "Cleveland",
  "Loretta",
  "Junior"
  )
);</pre>
</td>
</tr>
</tbody>
</table>
<p>The array above would look like this if written to the output:</p>
<table id="table28" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>Array
(
[Griffin] =&gt; Array
  (
  [0] =&gt; Peter
  [1] =&gt; Lois
  [2] =&gt; Megan
  )
[Quagmire] =&gt; Array
  (
  [0] =&gt; Glenn
  )
[Brown] =&gt; Array
  (
  [0] =&gt; Cleveland
  [1] =&gt; Loretta
  [2] =&gt; Junior
  )
)</pre>
</td>
</tr>
</tbody>
</table>
<h3>Example 2</h3>
<p>Lets try displaying a single value from the array above:</p>
<table id="table36" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>echo "Is " . $families['Griffin'][2] .
" a part of the Griffin family?";</pre>
</td>
</tr>
</tbody>
</table>
<p>The code above will output:</p>
<table id="table38" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>Is Megan a part of the Griffin family?</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/18/multidimensional-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Associative Arrays</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/18/associative-arrays/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/18/associative-arrays/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 06:02:12 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/?p=129</guid>
		<description><![CDATA[An associative array, each ID key is associated with a value.
When storing data about specific named values, a numerical array is not  always the best way to do it.
With associative arrays we can use the values as keys and assign values  to them.
Example 1
In this example we use an array to assign ages [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<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 id="table26" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>$ages = array("Peter"=&gt;32, "Quagmire"=&gt;30, "Joe"=&gt;34);</pre>
</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 id="table27" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>$ages['Peter'] = "32";
$ages['Quagmire'] = "30";
$ages['Joe'] = "34";</pre>
</td>
</tr>
</tbody>
</table>
<p>The ID keys can be used in a script:</p>
<table id="table31" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;?php</pre>
<pre>$ages['Peter'] = "32";
$ages['Quagmire'] = "30";
$ages['Joe'] = "34";</pre>
<pre>echo "Peter is " . $ages['Peter'] . " years old.";
?&gt;</pre>
</td>
</tr>
</tbody>
</table>
<p>The code above will output:</p>
<table id="table32" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>Peter is 32 years old.</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/18/associative-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Numeric Arrays</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/18/numeric-arrays/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/18/numeric-arrays/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 05:56:18 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/2008/11/18/numeric-arrays/</guid>
		<description><![CDATA[A numeric array stores each element with a numeric ID key.
There are different ways to create a numeric array.
Example 1
In this example the ID key is automatically assigned:




$names = array("Peter","Quagmire","Joe");




Example 2
In this example we assign the ID key manually:




$names[0] = "Peter";
$names[1] = "Quagmire";
$names[2] = "Joe";




The ID keys can be used in a script:




&#60;?php
$names[0] = "Peter";
$names[1] [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>A numeric array stores each element with a numeric ID key.</p>
<p>There are different ways to create a numeric array.</p>
<h3>Example 1</h3>
<p>In this example the ID key is automatically assigned:</p>
<table id="table11" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>$names = array("Peter","Quagmire","Joe");</pre>
</td>
</tr>
</tbody>
</table>
<h3>Example 2</h3>
<p>In this example we assign the ID key manually:</p>
<table id="table6" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>$names[0] = "Peter";
$names[1] = "Quagmire";
$names[2] = "Joe";</pre>
</td>
</tr>
</tbody>
</table>
<p>The ID keys can be used in a script:</p>
<table id="table12" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;?php</pre>
<pre>$names[0] = "Peter";
$names[1] = "Quagmire";
$names[2] = "Joe";</pre>
<pre>echo $names[1] . " and " . $names[2] .
" are ". $names[0] . "'s neighbors";
?&gt;</pre>
</td>
</tr>
</tbody>
</table>
<p>The code above will output:</p>
<table id="table13" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>Quagmire and Joe are Peter's neighbors</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/18/numeric-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Switch Statement</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/18/the-switch-statement/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/18/the-switch-statement/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 05:49:35 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/?p=125</guid>
		<description><![CDATA[If you want to select one of many blocks  of code to be executed, use the Switch statement.
The switch statement is used to avoid long blocks of if..elseif..else code.
Syntax




switch (expression)
{
case label1:
  code to be executed if expression = label1;
  break;
case label2:
  code to be executed if expression = label2;
  break;
default:
 [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>If you want to select one of many blocks  of code to be executed, use the Switch statement.</p>
<p>The switch statement is used to avoid long blocks of if..elseif..else code.</p>
<h3>Syntax</h3>
<table id="table11" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>switch (<em>expression</em>)
{
case <em>label1:</em>
  <em>code to be executed if expression = label1;</em>
  break;
case <em>label2:</em>
  <em>code to be executed if expression = label2;</em>
  break;
default:
  <em>code to be executed
  if expression is different
  from both label1 and label2;</em>
}</pre>
</td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>This is how it works:</p>
<ul>
<li>A single expression (most often a  variable) is evaluated once</li>
<li>The value of the expression is compared with the values for each case in  	the structure</li>
<li>If there is a match, the code associated with that case is executed</li>
<li>After a code is executed, <strong>break </strong>is used to stop the code from  	running into the next case</li>
<li>The default statement is used if none of the cases are true</li>
</ul>
<table id="table12" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;html&gt;
&lt;body&gt;</pre>
<pre>&lt;?php
switch ($x)
{
case 1:
  echo "Number 1";
  break;
case 2:
  echo "Number 2";
  break;
case 3:
  echo "Number 3";
  break;
default:
  echo "No number between 1 and 3";
}
?&gt;</pre>
<pre>&lt;/body&gt;
&lt;/html&gt;</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/18/the-switch-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The ElseIf Statement</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/18/the-elseif-statement/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/18/the-elseif-statement/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 05:33:53 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/2008/11/18/the-elseif-statement/</guid>
		<description><![CDATA[If you want to execute some code if one of several conditions are true use  the elseif statement
Syntax




if (condition)
  code to be executed if condition is true;
elseif (condition)
  code to be executed if condition is true;
else
  code to be executed if condition is false;




Example
The following example will output &#8220;Have a nice [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>If you want to execute some code if one of several conditions are true use  the elseif statement</p>
<h3>Syntax</h3>
<table id="table9" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>if (<em>condition</em>)
<em>  code to be executed if condition is true;</em>
elseif (<em>condition</em>)
<em>  code to be executed if condition is true;
</em>else
<em>  code to be executed if condition is false;</em></pre>
</td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The following example will output &#8220;Have a nice weekend!&#8221; if the current day  is Friday, and &#8220;Have a nice Sunday!&#8221; if the current day is Sunday. Otherwise it will output &#8220;Have a nice day!&#8221;:</p>
<table id="table10" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;html&gt;
&lt;body&gt;</pre>
<pre>&lt;?php
$d=date("D");
if ($d=="Fri")
  echo "Have a nice weekend!";
elseif ($d=="Sun")
  echo "Have a nice Sunday!";
else
  echo "Have a nice day!";
?&gt;</pre>
<pre>&lt;/body&gt;
&lt;/html&gt;</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/18/the-elseif-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The If&#8230;Else Statement</title>
		<link>http://blog.uad.ac.id/onggo/2008/11/18/the-ifelse-statement/</link>
		<comments>http://blog.uad.ac.id/onggo/2008/11/18/the-ifelse-statement/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 05:28:34 +0000</pubDate>
		<dc:creator>onggo</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://blog.uad.ac.id/onggo/?p=122</guid>
		<description><![CDATA[If you want to execute some code if a condition is true and another code if a  condition is false, use the if&#8230;.else statement.
Syntax




if (condition)
  code to be executed if condition is true;
else
  code to be executed if condition is false;




Example
The following example will output &#8220;Have a nice weekend!&#8221; if the current [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>If you want to execute some code if a condition is true and another code if a  condition is false, use the if&#8230;.else statement.</p>
<h3>Syntax</h3>
<table id="table6" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>if (<em>condition</em>)
<em>  code to be executed if condition is true;</em>
else
<em>  code to be executed if condition is false;</em></pre>
</td>
</tr>
</tbody>
</table>
<h3>Example</h3>
<p>The following example will output &#8220;Have a nice weekend!&#8221; if the current day  is Friday, otherwise it will output &#8220;Have a nice day!&#8221;:</p>
<table id="table7" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;html&gt;
&lt;body&gt;</pre>
<pre>&lt;?php
$d=date("D");
if ($d=="Fri")
  echo "Have a nice weekend!";
else
  echo "Have a nice day!";
?&gt;</pre>
<pre>&lt;/body&gt;
&lt;/html&gt;</pre>
</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 id="table8" class="ex" border="1" cellspacing="0" width="100%" bgcolor="#cccccc">
<tbody>
<tr>
<td>
<pre>&lt;html&gt;
&lt;body&gt;</pre>
<pre>&lt;?php
$d=date("D");
if ($d=="Fri")
  {
  echo "Hello!&lt;br /&gt;";
  echo "Have a nice weekend!";
  echo "See you on Monday!";
  }
?&gt;</pre>
<pre>&lt;/body&gt;
&lt;/html&gt;</pre>
</td>
</tr>
</tbody>
</table>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.uad.ac.id/onggo/2008/11/18/the-ifelse-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
