<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8101614521919315001</id><updated>2024-09-01T07:54:18.600-07:00</updated><title type='text'>Basic &amp;amp; workshops</title><subtitle type='html'>PHP + AJAX + DATABASE + MYSQL Full PHP&#xa;&#xa;Basic &amp;amp; workshops Oh PHP World PHP&#xa;&#xa;PHP GOOD PHPMYADMIN AppServ Apache &#xa;&#xa;AppServ + MySQL</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-3545106374801841705</id><published>2011-11-07T07:03:00.000-08:00</published><updated>2011-11-07T07:03:39.937-08:00</updated><title type='text'>All about PHP</title><content type='html'>&lt;a href=&quot;http://allphpzone.blogspot.com/&quot;&gt;All about PHP&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/3545106374801841705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/all-about-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/3545106374801841705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/3545106374801841705'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/all-about-php.html' title='All about PHP'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-5511839841448860217</id><published>2011-11-05T00:01:00.001-07:00</published><updated>2011-11-07T07:07:55.676-08:00</updated><title type='text'>PHP Tutorial</title><content type='html'>&lt;strong&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #a64d79;&quot;&gt;Introduction&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Up   until recently, scripting on the internet was something which very few people   even attempted, let alone mastered. Recently though, more and more people have   been building their own websites and scripting languages have become more   important. Because of this, scripting languages are becomming easier to learn   and PHP is one of the easiest and most powerful yet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #6fa8dc;&quot;&gt;What Is PHP?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP stands for Hypertext   Preprocessor and is a server-side language. This means that the script is run on   your web server, not on the user&#39;s browser, so you do not need to worry about   compatibility issues. PHP is relatively new (compared to languages such as Perl   (CGI) and Java) but is quickly becomming one of the most popular scripting   languages on the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Why   PHP?&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may be wondering why you should choose PHP over   other languages such as Perl or even why you should learn a scripting language   at all. I will deal with learning scripting languages first. Learning a   scripting language, or even understanding one, can open up huge new   possibilities for your website. Although you can download pre-made scripts from   sites like Hotscripts, these will often contain advertising for the author or   will not do exactly what you want. With an understanding of a scripting language   you can easily edit these scripts to do what you want, or even create your own   scripts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using scripts on your website allows you to add many new   &#39;interactive&#39; features like feedback forms, guestbooks, message boards, counters   and even more advanced features like portal systems, content management,   advertising managers etc. With these sort of things on your website you will   find that it gives a more professional image. As well as this, anyone wanting to   work in the site development industry will find that it is much easier to get a   job if they know a scripting language.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;What Do I Need?&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As mentioned earlier,   PHP is a server-side scripting language. This means that, although your users   will not need to install new software, you web host will need to have PHP set up   on their server. It should be listed as part of your package but if you don&#39;t   know if it is installed you can find out using the first script in this   tutorial. If you server does not support PHP you can ask your web host to   install it for you as it is free to download and install. If you need a low cost   web host which supports PHP I would recommmend HostRocket.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Writing PHP&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Writing PHP   on your computer is actually very simple. You don&#39;t need any specail software,   except for a text editor (like Notepad in Windows). Run this and you are ready   to write your first PHP script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Declaring PHP&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PHP scripts are always   enclosed in between two PHP tags. This tells your server to parse the   information between them as PHP. The three different forms are as   follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?&lt;br /&gt;
&lt;br /&gt;
PHP Code In   Here&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
PHP Code In Here&lt;br /&gt;
&lt;br /&gt;
php?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;script   language=&quot;php&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
PHP Code In Here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
All of   these work in exactly the same way but in this tutorial I will be using the   first option (&amp;lt;? and ?&amp;gt;). There is no particular reason for this, though,   and you can use either of the options. You must remember, though, to start and   end your code with the same tag (you can&#39;t start with &amp;lt;? and end with   &amp;lt;/script&amp;gt; for example).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Your   First Script&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first PHP script you will be writing is   very basic. All it will do is print out all the information about PHP on your   server. Type the following code into your text editor:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?&lt;br /&gt;
&lt;br /&gt;
phpinfo();&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see this   actually just one line of code. It is a standard PHP function called phpinfo   which will tell the server to print out a standard table of information giving   you information on the setup of the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One other thing you should   notice in this example is th&lt;br /&gt;
&lt;br /&gt;
at the line ends in a semicolon. This is very   important. As with many other scripting and programming languages nearly all   lines are ended with a semicolon and if you miss it out you will get an   error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Finishing and Testing Your   Script&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you have finished your script save it as   phpinfo.php and upload it to your server in the normal way. Now, using your   browser, go the the URL of the script. If it has worked (and if PHP is installed   on your server) you should get a huge page full of the information about PHP on   your server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your script doesn&#39;t work and a blank page displays, you   have either mistyped your code or your server does not support this function   (although I have not yet found a server that does not). If, instead of a page   being displayed, you are prompted to download the file, PHP is not installed on   your server and you should either serach for a new web host or ask your current   host to install PHP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is a good idea to keep this script for future   reference.</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/5511839841448860217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-tutorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/5511839841448860217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/5511839841448860217'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-tutorial.html' title='PHP Tutorial'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-2007189810399710206</id><published>2011-11-04T23:58:00.003-07:00</published><updated>2011-11-04T23:58:38.222-07:00</updated><title type='text'>PHP Introduction</title><content type='html'>&lt;p&gt;PHP is a server-side scripting language.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;What You Should Already Know&lt;/H2&gt;&lt;p&gt;Before you continue you should have a basic understanding of the   following:&lt;/p&gt;&lt;UL&gt;  &lt;LI&gt;HTML/XHTML&lt;/LI&gt;
  &lt;LI&gt;JavaScript&lt;/LI&gt;
&lt;/UL&gt;&lt;p&gt;If you want to study these subjects first, find the tutorials on our &lt;A href=&quot;/default.asp&quot;&gt;Home page&lt;/A&gt;.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;What is PHP?&lt;/H2&gt;&lt;UL&gt;  &lt;LI&gt;PHP stands for &lt;strong&gt;P&lt;/strong&gt;HP: &lt;strong&gt;H&lt;/strong&gt;ypertext &lt;strong&gt;P&lt;/strong&gt;reprocessor&lt;/LI&gt;
  &lt;LI&gt;PHP is a server-side scripting language, like ASP&lt;/LI&gt;
  &lt;LI&gt;PHP scripts are executed on the server&lt;/LI&gt;
  &lt;LI&gt;PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid,   PostgreSQL, Generic ODBC, etc.)&lt;/LI&gt;
  &lt;LI&gt;PHP is an open source software&lt;/LI&gt;
  &lt;LI&gt;PHP is free to download and use&lt;/LI&gt;
&lt;/UL&gt;&lt;H2&gt;What is a PHP File?&lt;/H2&gt;&lt;UL&gt;  &lt;LI&gt;PHP files can contain text, HTML tags and scripts&lt;/LI&gt;
  &lt;LI&gt;PHP files are returned to the browser as plain HTML&amp;nbsp;&lt;/LI&gt;
  &lt;LI&gt;PHP files have a file extension of &quot;.php&quot;, &quot;.php3&quot;, or &quot;.phtml&quot;&lt;/LI&gt;
&lt;/UL&gt;&lt;H2&gt;What is MySQL?&lt;/H2&gt;&lt;UL&gt;  &lt;LI&gt;MySQL is a database server&lt;/LI&gt;
  &lt;LI&gt;MySQL is ideal for both small and large applications&lt;/LI&gt;
  &lt;LI&gt;MySQL supports standard SQL&lt;/LI&gt;
  &lt;LI&gt;MySQL compiles on a number of platforms&lt;/LI&gt;
  &lt;LI&gt;MySQL is free to download and use&lt;/LI&gt;
&lt;/UL&gt;&lt;H2&gt;PHP + MySQL&lt;/H2&gt;&lt;UL&gt;  &lt;LI&gt;PHP combined with MySQL are cross-platform (you can develop in Windows and   serve on a Unix platform)&lt;/LI&gt;
&lt;/UL&gt;&lt;H2&gt;Why PHP?&lt;/H2&gt;&lt;UL&gt;  &lt;LI&gt;PHP runs on different platforms (Windows, Linux, Unix, etc.)&lt;/LI&gt;
  &lt;LI&gt;PHP is compatible with almost all servers used today (Apache, IIS,   etc.)&lt;/LI&gt;
  &lt;LI&gt;PHP is FREE to download from the official PHP resource: &lt;A href=&quot;http://www.php.net/&quot; target=&quot;_blank&quot;&gt;www.php.net&lt;/A&gt;&lt;/LI&gt;
  &lt;LI&gt;PHP is easy to learn and runs efficiently on the server side&lt;/LI&gt;
&lt;/UL&gt;&lt;H2&gt;Where to Start?&lt;/H2&gt;&lt;p&gt;To get access to a web server with PHP support, you can:&lt;/p&gt;&lt;UL&gt;  &lt;LI&gt;Install Apache (or IIS) on your own server, install PHP, and MySQL&lt;/LI&gt;
  &lt;LI&gt;Or find a web hosting plan with PHP and MySQL support&lt;/LI&gt;
&lt;/UL&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/2007189810399710206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/2007189810399710206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/2007189810399710206'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-introduction.html' title='PHP Introduction'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-9013353028452391938</id><published>2011-11-04T23:58:00.001-07:00</published><updated>2011-11-04T23:58:13.551-07:00</updated><title type='text'>PHP Installation</title><content type='html'>&lt;H2&gt;What do you Need?&lt;/H2&gt;&lt;p&gt;If your server supports PHP you don&#39;t need to do anything.&lt;/p&gt;&lt;p&gt;Just create some .php files in your web directory, and the server will parse   them for you. Because it is free, most web hosts offer PHP support.&lt;/p&gt;&lt;p&gt;However, if your server does not support PHP, you must install PHP.&lt;/p&gt;&lt;p&gt;Here is a link to a good tutorial from PHP.net on how to install PHP5: &lt;A href=&quot;http://www.php.net/manual/en/install.php&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/install.php&lt;/A&gt;&lt;/p&gt;&lt;H2&gt;Download PHP&lt;/H2&gt;&lt;p&gt;Download PHP for free here: &lt;A href=&quot;http://www.php.net/downloads.php&quot; target=&quot;_blank&quot;&gt;http://www.php.net/downloads.php&lt;/A&gt;&lt;/p&gt;&lt;H2&gt;Download MySQL Database&lt;/H2&gt;&lt;p&gt;Download MySQL for free here: &lt;A href=&quot;http://www.mysql.com/downloads/&quot; target=&quot;_blank&quot;&gt;http://www.mysql.com/downloads/&lt;/A&gt;&lt;/p&gt;&lt;H2&gt;Download Apache Server&lt;/H2&gt;&lt;p&gt;Download Apache for free here: &lt;A href=&quot;http://httpd.apache.org/download.cgi&quot; target=&quot;_blank&quot;&gt;http://httpd.apache.org/download.cgi&lt;/A&gt;&lt;/p&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/9013353028452391938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-installation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/9013353028452391938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/9013353028452391938'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-installation.html' title='PHP Installation'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-1862466310510607420</id><published>2011-11-04T23:57:00.001-07:00</published><updated>2011-11-04T23:57:37.532-07:00</updated><title type='text'>PHP Syntax</title><content type='html'>&lt;p&gt;PHP code is executed on the server, and the plain HTML result is   sent to the browser.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;Basic PHP Syntax&lt;/H2&gt;&lt;p&gt;A PHP scripting block always starts with &lt;strong&gt;&amp;lt;?php&lt;/strong&gt; and ends with &lt;strong&gt;?&amp;gt;&lt;/strong&gt;. A PHP scripting block can be placed anywhere in the document.&lt;/p&gt;&lt;p&gt;On servers with shorthand support enabled you can start a scripting block   with &amp;lt;? and end with ?&amp;gt;.&lt;/p&gt;&lt;p&gt;For maximum compatibility, we recommend that you use the standard form   (&amp;lt;?php) rather than the shorthand form.&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;A PHP file normally contains HTML tags, just like an HTML file, and some PHP   scripting code.&lt;/p&gt;&lt;p&gt;Below, we have an example of a simple PHP script which sends the text &quot;Hello   World&quot; to the browser:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    echo &quot;Hello   World&quot;;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Each code line in PHP must end with a semicolon. The semicolon is a separator   and is used to distinguish one set of instructions from another.&lt;/p&gt;&lt;p&gt;There are two basic statements to output text with PHP: &lt;strong&gt;echo&lt;/strong&gt; and &lt;strong&gt;print&lt;/strong&gt;. In the example above we have used the echo statement to output the   text &quot;Hello World&quot;.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The file must have a .php extension. If the file has a .html   extension, the PHP code will not be executed.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;Comments in PHP&lt;/H2&gt;&lt;p&gt;In PHP, we use // to make a single-line comment or /* and */ to make a large   comment block.&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    //This is a   comment&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    /*&lt;BR&gt;&lt;br /&gt;
    This is&lt;BR&gt;&lt;br /&gt;
    a   comment&lt;BR&gt;&lt;br /&gt;
    block&lt;BR&gt;&lt;br /&gt;
    */&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/1862466310510607420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-syntax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/1862466310510607420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/1862466310510607420'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-syntax.html' title='PHP Syntax'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-2465968307220740812</id><published>2011-11-04T23:56:00.003-07:00</published><updated>2011-11-04T23:56:53.655-07:00</updated><title type='text'>PHP Variables</title><content type='html'>&lt;p&gt;A variable is used to store information.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;Variables in PHP&lt;/H2&gt;&lt;p&gt;Variables are used for storing values, like text strings, numbers or   arrays.&lt;/p&gt;&lt;p&gt;When a variable is declared, it can be used over and over again in your   script.&lt;/p&gt;&lt;p&gt;All variables in PHP start with a $ sign symbol.&lt;/p&gt;&lt;p&gt;The correct way of declaring a variable in PHP:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;$var_name = value; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;New PHP programmers often forget the $ sign at the beginning of the variable.   In that case it will not work.&lt;/p&gt;&lt;p&gt;Let&#39;s try creating a variable containing a string, and a variable containing   a number:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $txt=&quot;Hello World!&quot;;&lt;BR&gt;&lt;br /&gt;
    $x=16;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;PHP is a Loosely Typed Language&lt;/H2&gt;&lt;p&gt;In PHP, a variable does not need to be declared before adding a value to   it.&lt;/p&gt;&lt;p&gt;In the example above, you see that you do not have to tell PHP which data   type the variable is.&lt;/p&gt;&lt;p&gt;PHP automatically converts the variable to the correct data type, depending   on its value.&lt;/p&gt;&lt;p&gt;In a strongly typed programming language, you have to declare (define) the   type and name of the variable before using it.&lt;/p&gt;&lt;p&gt;In PHP, the variable is declared automatically when you use it.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;Naming Rules for Variables&lt;/H2&gt;&lt;UL&gt;  &lt;LI&gt;A variable name must start with a letter or an underscore &quot;_&quot;&lt;/LI&gt;
  &lt;LI&gt;A variable name can only contain alpha-numeric characters and underscores   (a-z, A-Z, 0-9, and _ )&lt;/LI&gt;
  &lt;LI&gt;A variable name should not contain spaces. If a variable name is more than   one word, it should be separated with an underscore ($my_string), or with   capitalization ($myString)&lt;/LI&gt;
&lt;/UL&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/2465968307220740812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/2465968307220740812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/2465968307220740812'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-variables.html' title='PHP Variables'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-2610415855100516254</id><published>2011-11-04T23:56:00.001-07:00</published><updated>2011-11-04T23:56:24.031-07:00</updated><title type='text'>PHP String Variables</title><content type='html'>&lt;p&gt;A string variable is used to store and manipulate text.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;String Variables in PHP&lt;/H2&gt;&lt;p&gt;String variables are used for values that contain characters.&lt;/p&gt;&lt;p&gt;In this chapter we are going to look at the most common functions and   operators used to manipulate strings in PHP.&lt;/p&gt;&lt;p&gt;After we create a string we can manipulate it. A string can be used directly   in a function or it can be stored in a variable.&lt;/p&gt;&lt;p&gt;Below, the PHP script assigns the text &quot;Hello World&quot; to a string variable   called $txt:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $txt=&quot;Hello World&quot;;&lt;BR&gt;&lt;br /&gt;
    echo $txt;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The output of the code above will be:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Hello World &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Now, lets try to use some different functions and operators to manipulate the   string.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The Concatenation Operator&lt;/H2&gt;&lt;p&gt;There is only one string operator in PHP.&lt;/p&gt;&lt;p&gt;The concatenation operator (.)&amp;nbsp; is used to put two string values   together.&lt;/p&gt;&lt;p&gt;To concatenate two string variables together, use the concatenation   operator:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $txt1=&quot;Hello World!&quot;;&lt;BR&gt;&lt;br /&gt;
    $txt2=&quot;What a nice day!&quot;;&lt;BR&gt;&lt;br /&gt;
    echo   $txt1 . &quot; &quot; . $txt2;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The output of the code above will be:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Hello World! What a nice day! &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;If we look at the code above you see that we used the concatenation operator   two times. This is because we had to insert a third string (a space character),   to separate the two strings.&lt;BR&gt;&lt;br /&gt;
&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The strlen() function&lt;/H2&gt;&lt;p&gt;The strlen() function is used to return the length of a string.&lt;/p&gt;&lt;p&gt;Let&#39;s find the length of a string:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    echo strlen(&quot;Hello world!&quot;);&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The output of the code above will be:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;12 &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The length of a string is often used in loops or other functions, when it is   important to know when the string ends. (i.e. in a loop, we would want to stop   the loop after the last character in the string).&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The strpos() function&lt;/H2&gt;&lt;p&gt;The strpos() function is used to search for a character/text within a   string.&lt;/p&gt;&lt;p&gt;If a match is found, this function will return the character position of the   first match. If no match is found, it will return FALSE.&lt;/p&gt;&lt;p&gt;Let&#39;s see if we can find the string &quot;world&quot; in our string:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    echo strpos(&quot;Hello world!&quot;,&quot;world&quot;);&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The output of the code above will be:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;6 &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The position of the string &quot;world&quot; in the example above is 6. The reason that   it is 6 (and not 7), is that the first character position in the string is 0,   and not 1.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;Complete PHP String Reference&lt;/H2&gt;&lt;p&gt;For a complete reference of all string functions, go to our &lt;A href=&quot;php_ref_string.asp&quot;&gt;complete PHP String Reference&lt;/A&gt;.&lt;/p&gt;&lt;p&gt;The reference contains a brief description, and examples of use, for each   function!&lt;/p&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/2610415855100516254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-string-variables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/2610415855100516254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/2610415855100516254'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-string-variables.html' title='PHP String Variables'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-9014551747844252928</id><published>2011-11-04T23:55:00.000-07:00</published><updated>2011-11-04T23:55:28.533-07:00</updated><title type='text'>PHP Operators</title><content type='html'>&lt;p&gt;Operators are used to operate on values.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;PHP Operators&lt;/H2&gt;&lt;p&gt;This section lists the different operators used in PHP.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Arithmetic Operators&lt;/strong&gt;&lt;/p&gt;&lt;TABLE&gt;  &lt;TBODY&gt;
    &lt;TR&gt;
      &lt;TH width=&quot;15%&quot; align=&quot;left&quot;&gt;Operator&lt;/TH&gt;
      &lt;TH width=&quot;40%&quot; align=&quot;left&quot;&gt;Description&lt;/TH&gt;
      &lt;TH width=&quot;25%&quot; align=&quot;left&quot;&gt;Example&lt;/TH&gt;
      &lt;TH width=&quot;20%&quot; align=&quot;left&quot;&gt;Result&lt;/TH&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;+&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;Addition&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=2&lt;BR&gt;&lt;br /&gt;
        x+2&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;4&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;-&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;Subtraction&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=2&lt;BR&gt;&lt;br /&gt;
        5-x&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;3&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;*&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;Multiplication&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=4&lt;BR&gt;&lt;br /&gt;
        x*5&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;20&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;/&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;Division&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;15/5&lt;BR&gt;&lt;br /&gt;
        5/2&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;3&lt;BR&gt;&lt;br /&gt;
        2.5&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;%&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;Modulus (division remainder)&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;5%2&lt;BR&gt;&lt;br /&gt;
        10%8&lt;BR&gt;&lt;br /&gt;
        10%2&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;1&lt;BR&gt;&lt;br /&gt;
        2&lt;BR&gt;&lt;br /&gt;
        0&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;++&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;Increment&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=5&lt;BR&gt;&lt;br /&gt;
        x++&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=6&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;--&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;Decrement&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=5&lt;BR&gt;&lt;br /&gt;
        x--&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=4&lt;/TD&gt;
    &lt;/TR&gt;
  &lt;/TBODY&gt;
&lt;/TABLE&gt;&lt;p&gt;&lt;strong&gt;Assignment Operators&lt;/strong&gt;&lt;/p&gt;&lt;TABLE&gt;  &lt;TBODY&gt;
    &lt;TR&gt;
      &lt;TH width=&quot;15%&quot; align=&quot;left&quot;&gt;Operator&lt;/TH&gt;
      &lt;TH width=&quot;40%&quot; align=&quot;left&quot;&gt;Example&lt;/TH&gt;
      &lt;TH width=&quot;45%&quot; align=&quot;left&quot;&gt;Is The Same As&lt;/TH&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=y&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=y&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;+=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x+=y&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=x+y&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;-=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x-=y&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=x-y&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;*=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x*=y&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=x*y&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;/=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x/=y&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=x/y&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;.=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x.=y&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=x.y&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;%=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x%=y&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=x%y&lt;/TD&gt;
    &lt;/TR&gt;
  &lt;/TBODY&gt;
&lt;/TABLE&gt;&lt;p&gt;&lt;strong&gt;Comparison Operators&lt;/strong&gt;&lt;/p&gt;&lt;TABLE&gt;  &lt;TBODY&gt;
    &lt;TR&gt;
      &lt;TH width=&quot;15%&quot; align=&quot;left&quot;&gt;Operator&lt;/TH&gt;
      &lt;TH width=&quot;40%&quot; align=&quot;left&quot;&gt;Description&lt;/TH&gt;
      &lt;TH width=&quot;45%&quot; align=&quot;left&quot;&gt;Example&lt;/TH&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;==&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;is equal to&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;5==8 returns false&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;!=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;is not equal&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;5!=8 returns true&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;&amp;lt;&amp;gt;&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;is not equal&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;5&amp;lt;&amp;gt;8 returns true&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;&amp;gt;&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;is greater than&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;5&amp;gt;8 returns false&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;&amp;lt;&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;is less than&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;5&amp;lt;8 returns true&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;&amp;gt;=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;is greater than or equal to&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;5&amp;gt;=8 returns false&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;&amp;lt;=&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;is less than or equal to&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;5&amp;lt;=8 returns true&lt;/TD&gt;
    &lt;/TR&gt;
  &lt;/TBODY&gt;
&lt;/TABLE&gt;&lt;p&gt;&lt;strong&gt;Logical Operators&lt;/strong&gt;&lt;/p&gt;&lt;TABLE&gt;  &lt;TBODY&gt;
    &lt;TR&gt;
      &lt;TH width=&quot;15%&quot; align=&quot;left&quot;&gt;Operator&lt;/TH&gt;
      &lt;TH width=&quot;40%&quot; align=&quot;left&quot;&gt;Description&lt;/TH&gt;
      &lt;TH width=&quot;45%&quot; align=&quot;left&quot;&gt;Example&lt;/TH&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;&amp;amp;&amp;amp;&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;and&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=6&lt;BR&gt;&lt;br /&gt;
        y=3&lt;br /&gt;
        &lt;p&gt;(x &amp;lt; 10 &amp;amp;&amp;amp; y &amp;gt; 1) returns true&lt;/p&gt;&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;||&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;or&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=6&lt;BR&gt;&lt;br /&gt;
        y=3&lt;br /&gt;
        &lt;p&gt;(x==5 || y==5) returns false&lt;/p&gt;&lt;/TD&gt;
    &lt;/TR&gt;
    &lt;TR&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;!&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;not&lt;/TD&gt;
      &lt;TD vAlign=&quot;top&quot;&gt;x=6&lt;BR&gt;&lt;br /&gt;
        y=3&lt;br /&gt;
        &lt;p&gt;!(x==y) returns true&lt;/p&gt;&lt;/TD&gt;
    &lt;/TR&gt;
  &lt;/TBODY&gt;
&lt;/TABLE&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/9014551747844252928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-operators.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/9014551747844252928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/9014551747844252928'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-operators.html' title='PHP Operators'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-5198084399629318379</id><published>2011-11-04T23:54:00.001-07:00</published><updated>2011-11-04T23:54:26.123-07:00</updated><title type='text'>PHP If...Else Statements</title><content type='html'>&lt;p&gt;Conditional statements are used to perform different actions   based on different conditions.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;Conditional Statements&lt;/H2&gt;&lt;p&gt;Very often when you write code, you want to perform different actions for   different decisions. &lt;/p&gt;&lt;p&gt;You can use conditional statements in your code to do this.&lt;/p&gt;&lt;p&gt;In PHP we have the following conditional statements:&lt;/p&gt;&lt;UL&gt;  &lt;LI&gt;&lt;strong&gt;if statement&lt;/strong&gt; - use this statement to execute some code only if a   specified condition is true&lt;/LI&gt;
  &lt;LI&gt;&lt;strong&gt;if...else statement&lt;/strong&gt; - use this statement to execute some code if a   condition is true and another code if the condition is false&lt;/LI&gt;
  &lt;LI&gt;&lt;strong&gt;if...elseif....else statement&lt;/strong&gt; - use this statement to select one of   several blocks of code to be executed&lt;/LI&gt;
  &lt;LI&gt;&lt;strong&gt;switch statement&lt;/strong&gt; - use this statement to select one of many blocks of   code to be executed&lt;/LI&gt;
&lt;/UL&gt;&lt;HR&gt;&lt;H2&gt;The if Statement&lt;/H2&gt;&lt;p&gt;Use the if statement to execute some code only if a specified condition is   true.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;if (&lt;em&gt;condition&lt;/em&gt;) &lt;em&gt;code to be executed if condition is   true;&lt;/em&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The following example will output &quot;Have a nice weekend!&quot; if the current day   is Friday:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $d=date(&quot;D&quot;);&lt;BR&gt;&lt;br /&gt;
    if   ($d==&quot;Fri&quot;) echo &quot;Have a nice   weekend!&quot;;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Notice that there is no ..else.. in this syntax. The code is executed &lt;strong&gt;only   if the specified condition is true&lt;/strong&gt;.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The if...else Statement&lt;/H2&gt;&lt;p&gt;Use the if....else statement to execute some code if a condition is true and   another code if a condition is false.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;if (&lt;em&gt;condition&lt;/em&gt;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be executed if condition is   true;&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    else&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be executed if condition is false;&lt;/em&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;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;:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $d=date(&quot;D&quot;);&lt;BR&gt;&lt;br /&gt;
    if   ($d==&quot;Fri&quot;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Have a nice weekend!&quot;;&lt;BR&gt;&lt;br /&gt;
    else&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Have a nice   day!&quot;;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;If more than one line should be executed if a condition is true/false, the   lines should be enclosed within curly braces:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $d=date(&quot;D&quot;);&lt;BR&gt;&lt;br /&gt;
    if   ($d==&quot;Fri&quot;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Hello!&amp;lt;br /&amp;gt;&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Have a nice   weekend!&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;See you on   Monday!&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;The &lt;strong&gt;if...elseif....else&lt;/strong&gt; Statement&lt;/H2&gt;&lt;p&gt;Use the if....elseif...else statement to select one of several blocks of code   to be executed.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;if (&lt;em&gt;condition&lt;/em&gt;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be executed if condition is   true;&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    elseif (&lt;em&gt;condition&lt;/em&gt;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be executed if condition   is true;&lt;BR&gt;&lt;br /&gt;
      &lt;/em&gt;else&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be executed if condition is false;&lt;/em&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;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;:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $d=date(&quot;D&quot;);&lt;BR&gt;&lt;br /&gt;
    if   ($d==&quot;Fri&quot;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Have a nice weekend!&quot;;&lt;BR&gt;&lt;br /&gt;
    elseif ($d==&quot;Sun&quot;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo   &quot;Have a nice Sunday!&quot;;&lt;BR&gt;&lt;br /&gt;
    else&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Have a nice   day!&quot;;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/5198084399629318379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-ifelse-statements.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/5198084399629318379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/5198084399629318379'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-ifelse-statements.html' title='PHP If...Else Statements'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-4614793293018261261</id><published>2011-11-04T23:53:00.003-07:00</published><updated>2011-11-04T23:53:52.780-07:00</updated><title type='text'>PHP Switch Statement</title><content type='html'>&lt;p&gt;Conditional statements are used to perform different actions   based on different conditions.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The PHP Switch Statement&lt;/H2&gt;&lt;p&gt;Use the switch statement to select one of many blocks of code to be   executed.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;switch (&lt;em&gt;n&lt;/em&gt;)&lt;BR&gt;&lt;br /&gt;
    {&lt;BR&gt;&lt;br /&gt;
    case &lt;em&gt;label1:&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be executed   if n=label1;&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&lt;br /&gt;
    case &lt;em&gt;label2:&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be executed   if n=label2;&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&lt;br /&gt;
    default:&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be executed if n is   different from both label1 and label2;&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    } &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;This is how it works: First we have a single expression &lt;em&gt;n&lt;/em&gt; (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 &lt;strong&gt;break&lt;/strong&gt; to   prevent the code from running into the next case automatically. The default   statement is used if no match is found.&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    switch ($x)&lt;BR&gt;&lt;br /&gt;
    {&lt;BR&gt;&lt;br /&gt;
    case   1:&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Number 1&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&lt;br /&gt;
    case 2:&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Number   2&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&lt;br /&gt;
    case 3:&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;Number   3&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;break;&lt;BR&gt;&lt;br /&gt;
    default:&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;No number between 1 and   3&quot;;&lt;BR&gt;&lt;br /&gt;
    }&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/4614793293018261261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-switch-statement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/4614793293018261261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/4614793293018261261'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-switch-statement.html' title='PHP Switch Statement'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-8357348671828550494</id><published>2011-11-04T23:53:00.001-07:00</published><updated>2011-11-04T23:53:21.281-07:00</updated><title type='text'>PHP Arrays</title><content type='html'>&lt;p&gt;An array stores multiple values in one single variable.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;What is an Array?&lt;/H2&gt;&lt;p&gt;A variable is a storage area holding a number or text. The problem is, a   variable will hold only one value.&lt;/p&gt;&lt;p&gt;An array is a special variable, which can store multiple values in one single   variable.&lt;/p&gt;&lt;p&gt;If you have a list of items (a list of car names, for example), storing the   cars in single variables could look like this:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;$cars1=&quot;Saab&quot;;&lt;BR&gt;&lt;br /&gt;
    $cars2=&quot;Volvo&quot;;&lt;BR&gt;&lt;br /&gt;
    $cars3=&quot;BMW&quot;; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;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?&lt;/p&gt;&lt;p&gt;The best solution here is to use an array!&lt;/p&gt;&lt;p&gt;An array can hold all your variable values under a single name. And you can   access the values by referring to the array name.&lt;/p&gt;&lt;p&gt;Each element in the array has its own index so that it can be easily   accessed.&lt;/p&gt;&lt;p&gt;In PHP, there are three kind of arrays:&lt;/p&gt;&lt;UL&gt;  &lt;LI&gt;&lt;strong&gt;Numeric array&lt;/strong&gt; - An array with a numeric index&lt;/LI&gt;
  &lt;LI&gt;&lt;strong&gt;Associative array&lt;/strong&gt; - An array where each ID key is associated with a   value&lt;/LI&gt;
  &lt;LI&gt;&lt;strong&gt;Multidimensional array&lt;/strong&gt; - An array containing one or more   arrays&lt;/LI&gt;
&lt;/UL&gt;&lt;HR&gt;&lt;H2&gt;Numeric Arrays&lt;/H2&gt;&lt;p&gt;A numeric array stores each array element with a numeric index.&lt;/p&gt;&lt;p&gt;There are two methods to create a numeric array.&lt;/p&gt;&lt;p&gt;1. In the following example the index are automatically assigned (the index   starts at 0):&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;$cars=array(&quot;Saab&quot;,&quot;Volvo&quot;,&quot;BMW&quot;,&quot;Toyota&quot;); &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;2. In the following example we assign the index manually:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;$cars[0]=&quot;Saab&quot;;&lt;BR&gt;&lt;br /&gt;
    $cars[1]=&quot;Volvo&quot;;&lt;BR&gt;&lt;br /&gt;
    $cars[2]=&quot;BMW&quot;;&lt;BR&gt;&lt;br /&gt;
    $cars[3]=&quot;Toyota&quot;; &lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;In the following example you access the variable values by referring to the   array name and index:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $cars[0]=&quot;Saab&quot;;&lt;BR&gt;&lt;br /&gt;
    $cars[1]=&quot;Volvo&quot;;&lt;BR&gt;&lt;br /&gt;
    $cars[2]=&quot;BMW&quot;;&lt;BR&gt;&lt;br /&gt;
    $cars[3]=&quot;Toyota&quot;; &lt;BR&gt;&lt;br /&gt;
    echo $cars[0] . &quot; and &quot; . $cars[1] . &quot; are Swedish cars.&quot;;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The code above will output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Saab and Volvo are Swedish cars.&lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;Associative Arrays&lt;/H2&gt;&lt;p&gt;An associative array, each ID key is associated with a value.&lt;/p&gt;&lt;p&gt;When storing data about specific named values, a numerical array is not   always the best way to do it.&lt;/p&gt;&lt;p&gt;With associative arrays we can use the values as keys and assign values to   them.&lt;/p&gt;&lt;H3&gt;Example 1&lt;/H3&gt;&lt;p&gt;In this example we use an array to assign ages to the different persons:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;$ages = array(&quot;Peter&quot;=&amp;gt;32, &quot;Quagmire&quot;=&amp;gt;30, &quot;Joe&quot;=&amp;gt;34); &lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example 2&lt;/H3&gt;&lt;p&gt;This example is the same as example 1, but shows a different way of creating   the array:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;$ages[&#39;Peter&#39;] = &quot;32&quot;;&lt;BR&gt;&lt;br /&gt;
    $ages[&#39;Quagmire&#39;] = &quot;30&quot;;&lt;BR&gt;&lt;br /&gt;
    $ages[&#39;Joe&#39;] = &quot;34&quot;; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The ID keys can be used in a script:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $ages[&#39;Peter&#39;] = &quot;32&quot;;&lt;BR&gt;&lt;br /&gt;
    $ages[&#39;Quagmire&#39;] =   &quot;30&quot;;&lt;BR&gt;&lt;br /&gt;
    $ages[&#39;Joe&#39;] = &quot;34&quot;;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    echo &quot;Peter is &quot; . $ages[&#39;Peter&#39;] . &quot; years   old.&quot;;&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The code above will output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Peter is 32 years old. &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;Multidimensional Arrays&lt;/H2&gt;&lt;p&gt;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.&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;In this example we create a multidimensional array, with automatically   assigned ID keys:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;$families =   array&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;(&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Griffin&quot;=&amp;gt;array&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;(&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Peter&quot;,&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Lois&quot;,&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Megan&quot;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;),&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Quagmire&quot;=&amp;gt;array&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;(&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Glenn&quot;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;),&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Brown&quot;=&amp;gt;array&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;(&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Cleveland&quot;,&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Loretta&quot;,&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&quot;Junior&quot;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;); &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The array above would look like this if written to the output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Array&lt;BR&gt;&lt;br /&gt;
    (&lt;BR&gt;&lt;br /&gt;
    [Griffin] =&amp;gt; Array&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;(&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;[0] =&amp;gt; Peter&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;[1]   =&amp;gt; Lois&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;[2] =&amp;gt; Megan&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;)&lt;BR&gt;&lt;br /&gt;
    [Quagmire] =&amp;gt; Array&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;(&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;[0]   =&amp;gt; Glenn&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;)&lt;BR&gt;&lt;br /&gt;
    [Brown] =&amp;gt; Array&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;(&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;[0] =&amp;gt;   Cleveland&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;[1] =&amp;gt; Loretta&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;[2] =&amp;gt; Junior&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;)&lt;BR&gt;&lt;br /&gt;
    ) &lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example 2&lt;/H3&gt;&lt;p&gt;Lets try displaying a single value from the array above:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;echo &quot;Is &quot; . $families[&#39;Griffin&#39;][2] . &lt;BR&gt;&lt;br /&gt;
    &quot; a part of the Griffin   family?&quot;; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The code above will output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Is Megan a part of the Griffin family? &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;Complete PHP Array Reference&lt;/H2&gt;&lt;p&gt;For a complete reference of all array functions, go to our &lt;A href=&quot;php_ref_array.asp&quot;&gt;complete PHP Array Reference&lt;/A&gt;.&lt;/p&gt;&lt;p&gt;The reference contains a brief description, and examples of use, for each   function!&lt;/p&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/8357348671828550494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-arrays.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/8357348671828550494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/8357348671828550494'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-arrays.html' title='PHP Arrays'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-4358143188831867949</id><published>2011-11-04T23:52:00.001-07:00</published><updated>2011-11-04T23:52:55.104-07:00</updated><title type='text'>PHP Looping - While Loops</title><content type='html'>&lt;p&gt;Loops execute a block of code a specified number of times, or   while a specified condition is true.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;PHP Loops&lt;/H2&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;In PHP, we have the following looping statements:&lt;/p&gt;&lt;UL&gt;  &lt;LI&gt;&lt;strong&gt;while &lt;/strong&gt;- loops through a block of code while a specified condition is   true&lt;/LI&gt;
  &lt;LI&gt;&lt;strong&gt;do...while&lt;/strong&gt; - loops through a block of code once, and then repeats the   loop as long as a specified condition is true&lt;/LI&gt;
  &lt;LI&gt;&lt;strong&gt;for &lt;/strong&gt;- loops through a block of code a specified number of times&lt;/LI&gt;
  &lt;LI&gt;&lt;strong&gt;foreach &lt;/strong&gt;- loops through a block of code for each element in an   array&lt;/LI&gt;
&lt;/UL&gt;&lt;HR&gt;&lt;H2&gt;The while Loop&lt;/H2&gt;&lt;p&gt;The while loop executes a block of code while a condition is true.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;while (&lt;em&gt;condition&lt;/em&gt;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; {&lt;BR&gt;&lt;br /&gt;
    &lt;em&gt;&amp;nbsp; code to be executed&lt;/em&gt;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; } &lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;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:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $i=1;&lt;BR&gt;&lt;br /&gt;
    while($i&amp;lt;=5)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo   &quot;The number is &quot; . $i . &quot;&amp;lt;br   /&amp;gt;&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;$i++;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;The number is 1&lt;BR&gt;&lt;br /&gt;
    The number is 2&lt;BR&gt;&lt;br /&gt;
    The number is 3&lt;BR&gt;&lt;br /&gt;
    The number is   4&lt;BR&gt;&lt;br /&gt;
    The number is 5 &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;The do...while Statement&lt;/H2&gt;&lt;p&gt;The do...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.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;do&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; {&lt;BR&gt;&lt;br /&gt;
    &lt;em&gt;&amp;nbsp; code to be executed;&lt;BR&gt;&lt;br /&gt;
      &amp;nbsp; &lt;/em&gt;}&lt;BR&gt;&lt;br /&gt;
    while   (&lt;em&gt;condition&lt;/em&gt;); &lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;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:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $i=1;&lt;BR&gt;&lt;br /&gt;
    do&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;{&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;$i++;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo   &quot;The number is &quot; . $i . &quot;&amp;lt;br /&amp;gt;&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;}&lt;BR&gt;&lt;br /&gt;
    while   ($i&amp;lt;=5);&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;The number is 2&lt;BR&gt;&lt;br /&gt;
    The number is 3&lt;BR&gt;&lt;br /&gt;
    The number is 4&lt;BR&gt;&lt;br /&gt;
    The number is   5&lt;BR&gt;&lt;br /&gt;
    The number is 6 &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The for loop and the foreach loop will be explained in the next   chapter.&lt;/p&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/4358143188831867949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-looping-while-loops.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/4358143188831867949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/4358143188831867949'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-looping-while-loops.html' title='PHP Looping - While Loops'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-5138912179896842923</id><published>2011-11-04T23:50:00.000-07:00</published><updated>2011-11-04T23:50:24.708-07:00</updated><title type='text'>PHP Looping - For Loops</title><content type='html'>&lt;p&gt;Loops execute a block of code a specified number of times, or   while a specified condition is true.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The for Loop&lt;/H2&gt;&lt;p&gt;The for loop is used when you know in advance how many times the script   should run.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;for (&lt;em&gt;init; condition; increment&lt;/em&gt;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; {&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be   executed;&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; } &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Parameters:&lt;/p&gt;&lt;UL&gt;  &lt;LI&gt;&lt;em&gt;init&lt;/em&gt;: Mostly used to set a counter (but can be any code to be   executed once at the beginning of the loop)&lt;/LI&gt;
  &lt;LI&gt;&lt;em&gt;condition&lt;/em&gt;: Evaluated for each loop iteration. If it evaluates to   TRUE, the loop continues. If it evaluates to FALSE, the loop ends.&lt;/LI&gt;
  &lt;LI&gt;&lt;em&gt;increment&lt;/em&gt;: Mostly used to increment a counter (but can be any code to   be executed at the end of the loop)&lt;/LI&gt;
&lt;/UL&gt;&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;Each of the parameters above can be empty, or have multiple   expressions (separated by commas).&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;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:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    for ($i=1; $i&amp;lt;=5;   $i++)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; {&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo &quot;The number is &quot; . $i . &quot;&amp;lt;br /&amp;gt;&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;   }&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;The number is 1&lt;BR&gt;&lt;br /&gt;
    The number is 2&lt;BR&gt;&lt;br /&gt;
    The number is 3&lt;BR&gt;&lt;br /&gt;
    The number is   4&lt;BR&gt;&lt;br /&gt;
    The number is 5 &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;The foreach Loop&lt;/H2&gt;&lt;p&gt;The foreach loop is used to loop through arrays.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;foreach ($&lt;em&gt;array &lt;/em&gt;as&lt;em&gt; &lt;/em&gt;$&lt;em&gt;value&lt;/em&gt;)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; {&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;&lt;em&gt;code to be   executed;&lt;/em&gt;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; } &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;For every loop iteration, the value of the current array element is assigned   to $value (and the array pointer is moved by one) - so on the next loop   iteration, you&#39;ll be looking at the next array value.&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;The following example demonstrates a loop that will print the values of the   given array:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    $x=array(&quot;one&quot;,&quot;two&quot;,&quot;three&quot;);&lt;BR&gt;&lt;br /&gt;
    foreach   ($x as $value)&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp; {&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;&amp;nbsp;echo $value . &quot;&amp;lt;br /&amp;gt;&quot;;&lt;BR&gt;&lt;br /&gt;
    &amp;nbsp;   }&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;one&lt;BR&gt;&lt;br /&gt;
    two&lt;BR&gt;&lt;br /&gt;
    three &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/5138912179896842923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-looping-for-loops.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/5138912179896842923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/5138912179896842923'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-looping-for-loops.html' title='PHP Looping - For Loops'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-8920914974557582011</id><published>2011-11-04T23:49:00.000-07:00</published><updated>2011-11-04T23:49:33.130-07:00</updated><title type='text'>PHP Functions</title><content type='html'>&lt;p&gt;The real power of PHP comes from its functions.&lt;/p&gt;&lt;p&gt;In PHP, there are more than 700 built-in functions.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;PHP Built-in Functions&lt;/H2&gt;&lt;p&gt;For a complete reference and examples of the built-in functions, please visit   our &lt;A href=&quot;default.asp&quot;&gt;PHP Reference.&lt;/A&gt;&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;PHP Functions&lt;/H2&gt;&lt;p&gt;In this chapter we will show you how to create your own functions.&lt;/p&gt;&lt;p&gt;To keep the script from being executed when the page loads, you can put it   into a function.&lt;/p&gt;&lt;p&gt;A function will be executed by a call to the function.&lt;/p&gt;&lt;p&gt;You may call a function from anywhere within a page.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;Create a PHP Function&lt;/H2&gt;&lt;p&gt;A function will be executed by a call to the function.&lt;/p&gt;&lt;H3&gt;Syntax&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;function &lt;em&gt;functionName&lt;/em&gt;()&lt;BR&gt;&lt;br /&gt;
    {&lt;BR&gt;&lt;br /&gt;
    &lt;em&gt;code to be executed&lt;/em&gt;;&lt;BR&gt;&lt;br /&gt;
    } &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;PHP function guidelines:&lt;/p&gt;&lt;UL&gt;  &lt;LI&gt;Give the function a name that reflects what the function does&lt;/LI&gt;
  &lt;LI&gt;The function name can start with a letter or underscore (not a   number)&lt;/LI&gt;
&lt;/UL&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;A simple function that writes my name when it is called:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    function   writeName()&lt;BR&gt;&lt;br /&gt;
    {&lt;BR&gt;&lt;br /&gt;
    echo &quot;Kai Jim Refsnes&quot;;&lt;BR&gt;&lt;br /&gt;
    }&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    echo &quot;My name is   &quot;;&lt;BR&gt;&lt;br /&gt;
    writeName();&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;My name is Kai Jim Refsnes &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;PHP Functions - Adding parameters&lt;/H2&gt;&lt;p&gt;To add more functionality to a function, we can add parameters. A parameter   is just like a variable.&lt;/p&gt;&lt;p&gt;Parameters are specified after the function name, inside the parentheses.&lt;/p&gt;&lt;H3&gt;Example 1&lt;/H3&gt;&lt;p&gt;The following example will write different first names, but equal last   name:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    function   writeName($fname)&lt;BR&gt;&lt;br /&gt;
    {&lt;BR&gt;&lt;br /&gt;
    echo $fname . &quot; Refsnes.&amp;lt;br   /&amp;gt;&quot;;&lt;BR&gt;&lt;br /&gt;
    }&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    echo &quot;My name is &quot;;&lt;BR&gt;&lt;br /&gt;
    writeName(&quot;Kai Jim&quot;);&lt;BR&gt;&lt;br /&gt;
    echo &quot;My   sister&#39;s name is &quot;;&lt;BR&gt;&lt;br /&gt;
    writeName(&quot;Hege&quot;);&lt;BR&gt;&lt;br /&gt;
    echo &quot;My brother&#39;s name is   &quot;;&lt;BR&gt;&lt;br /&gt;
    writeName(&quot;Stale&quot;);&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;My name is Kai Jim Refsnes.&lt;BR&gt;&lt;br /&gt;
    My sister&#39;s name is Hege Refsnes.&lt;BR&gt;&lt;br /&gt;
    My   brother&#39;s name is Stale Refsnes. &lt;/DIV&gt;&lt;/DIV&gt;&lt;H3&gt;Example 2&lt;/H3&gt;&lt;p&gt;The following function has two parameters:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    function   writeName($fname,$punctuation)&lt;BR&gt;&lt;br /&gt;
    {&lt;BR&gt;&lt;br /&gt;
    echo $fname . &quot; Refsnes&quot; . $punctuation .   &quot;&amp;lt;br /&amp;gt;&quot;;&lt;BR&gt;&lt;br /&gt;
    }&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    echo &quot;My name is &quot;;&lt;BR&gt;&lt;br /&gt;
    writeName(&quot;Kai   Jim&quot;,&quot;.&quot;);&lt;BR&gt;&lt;br /&gt;
    echo &quot;My sister&#39;s name is &quot;;&lt;BR&gt;&lt;br /&gt;
    writeName(&quot;Hege&quot;,&quot;!&quot;);&lt;BR&gt;&lt;br /&gt;
    echo &quot;My   brother&#39;s name is   &quot;;&lt;BR&gt;&lt;br /&gt;
    writeName(&quot;St&amp;aring;le&quot;,&quot;?&quot;);&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;My name is Kai Jim Refsnes.&lt;BR&gt;&lt;br /&gt;
    My sister&#39;s name is Hege Refsnes!&lt;BR&gt;&lt;br /&gt;
    My   brother&#39;s name is St&amp;aring;le Refsnes? &lt;/DIV&gt;&lt;/DIV&gt; &lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;PHP Functions - Return values&lt;/H2&gt;&lt;p&gt;To let a function return a value, use the return statement.&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;?php&lt;BR&gt;&lt;br /&gt;
    function   add($x,$y)&lt;BR&gt;&lt;br /&gt;
    {&lt;BR&gt;&lt;br /&gt;
    $total=$x+$y;&lt;BR&gt;&lt;br /&gt;
    return $total;&lt;BR&gt;&lt;br /&gt;
    }&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    echo &quot;1 + 16 = &quot;   . add(1,16);&lt;BR&gt;&lt;br /&gt;
    ?&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;1 + 16 = 17 &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/8920914974557582011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/8920914974557582011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/8920914974557582011'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-functions.html' title='PHP Functions'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-3186719611943339446</id><published>2011-11-04T23:48:00.001-07:00</published><updated>2011-11-04T23:48:34.499-07:00</updated><title type='text'>PHP Forms and User Input</title><content type='html'>&lt;p&gt;The PHP $_GET and $_POST variables are used to retrieve   information from forms, like user input.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;PHP Form Handling&lt;/H2&gt;&lt;p&gt;The most important thing to notice when dealing with HTML forms and PHP is   that any form element in an HTML page will &lt;strong&gt;automatically&lt;/strong&gt; be available to   your PHP scripts.&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;p&gt;The example below contains an HTML form with two input fields and a submit   button:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;form action=&quot;welcome.php&quot;   method=&quot;post&quot;&amp;gt;&lt;BR&gt;&lt;br /&gt;
    Name: &amp;lt;input type=&quot;text&quot; name=&quot;fname&quot; /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    Age:   &amp;lt;input type=&quot;text&quot; name=&quot;age&quot; /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;input type=&quot;submit&quot;   /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/form&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;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;:&lt;/p&gt;&lt;p&gt;&quot;welcome.php&quot; looks like this:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    Welcome &amp;lt;?php echo $_POST[&quot;fname&quot;];   ?&amp;gt;!&amp;lt;br /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    You are &amp;lt;?php echo $_POST[&quot;age&quot;]; ?&amp;gt; years   old.&lt;BR&gt;&lt;br /&gt;
    &lt;BR&gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/html&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;Output could be something like this:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Welcome John!&lt;BR&gt;&lt;br /&gt;
    You are 28 years old. &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The PHP $_GET and $_POST variables will be explained in the next   chapters.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;Form Validation&lt;/H2&gt;&lt;p&gt;User input should be validated on the browser whenever possible (by client   scripts). Browser validation is faster and reduces the server load.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/3186719611943339446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-forms-and-user-input.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/3186719611943339446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/3186719611943339446'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-forms-and-user-input.html' title='PHP Forms and User Input'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-6576669572063558745</id><published>2011-11-04T23:46:00.001-07:00</published><updated>2011-11-04T23:46:34.110-07:00</updated><title type='text'>PHP $_GET Variable</title><content type='html'>&lt;p&gt;In PHP, the predefined $_GET variable is used to collect values   in a form with method=&quot;get&quot;.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The $_GET Variable&lt;/H2&gt;&lt;p&gt;The predefined $_GET variable is used to collect values in a form with   method=&quot;get&quot;&lt;/p&gt;&lt;p&gt;Information sent from a form with the GET method is visible to everyone (it   will be displayed in the browser&#39;s address bar) and has limits on the amount of   information to send.&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;form action=&quot;welcome.php&quot; method=&quot;get&quot;&amp;gt;&lt;BR&gt;&lt;br /&gt;
    Name: &amp;lt;input   type=&quot;text&quot; name=&quot;fname&quot; /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    Age: &amp;lt;input type=&quot;text&quot; name=&quot;age&quot;   /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;input type=&quot;submit&quot; /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/form&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;When the user clicks the &quot;Submit&quot; button, the URL sent to the server could   look something like this:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;http://www.w3schools.com/welcome.php?fname=Peter&amp;amp;age=37 &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The &quot;welcome.php&quot; file can now use the $_GET variable to collect form data   (the names of the form fields will automatically be the keys in the $_GET   array):&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Welcome &amp;lt;?php echo $_GET[&quot;fname&quot;]; ?&amp;gt;.&amp;lt;br /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    You are   &amp;lt;?php echo $_GET[&quot;age&quot;]; ?&amp;gt; years old! &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;When to use method=&quot;get&quot;?&lt;/H2&gt;&lt;p&gt;When using method=&quot;get&quot; in HTML forms, all variable names and values are   displayed in the URL.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This method should not be used when sending passwords or other   sensitive information!&lt;/p&gt;&lt;p&gt;However, because the variables are displayed in the URL, it is possible to   bookmark the page. This can be useful in some cases.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The get method is not suitable for very large variable values.   It should not be used with values exceeding 2000 characters.&lt;BR&gt;&lt;br /&gt;
&lt;/p&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/6576669572063558745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-get-variable.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/6576669572063558745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/6576669572063558745'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-get-variable.html' title='PHP $_GET Variable'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8101614521919315001.post-3576357015318775415</id><published>2011-11-04T23:43:00.001-07:00</published><updated>2011-11-04T23:43:40.768-07:00</updated><title type='text'>PHP $_POST Function</title><content type='html'>&lt;p&gt;In PHP, the predefined&amp;nbsp; $_POST variable is used to collect values   in a form with method=&quot;post&quot;.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The $_POST Variable&lt;/H2&gt;&lt;p&gt;The predefined $_POST variable is used to collect values from a form sent   with method=&quot;post&quot;.&lt;/p&gt;&lt;p&gt;Information sent from a form with the POST method is invisible to others and   has no limits on the amount of information to send.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; 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).&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;&amp;lt;form action=&quot;welcome.php&quot; method=&quot;post&quot;&amp;gt;&lt;BR&gt;&lt;br /&gt;
    Name: &amp;lt;input   type=&quot;text&quot; name=&quot;fname&quot; /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    Age: &amp;lt;input type=&quot;text&quot; name=&quot;age&quot;   /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;input type=&quot;submit&quot; /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    &amp;lt;/form&amp;gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;When the user clicks the &quot;Submit&quot; button, the URL will look like this:&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;http://www.w3schools.com/welcome.php &lt;/DIV&gt;&lt;/DIV&gt;&lt;p&gt;The &quot;welcome.php&quot; file can now use the $_POST variable to collect form data   (the names of the form fields will automatically be the keys in the $_POST   array):&lt;/p&gt;&lt;DIV&gt;  &lt;DIV&gt;Welcome &amp;lt;?php echo $_POST[&quot;fname&quot;]; ?&amp;gt;!&amp;lt;br /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    You are   &amp;lt;?php echo $_POST[&quot;age&quot;]; ?&amp;gt; years old. &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;&lt;br /&gt;
&lt;HR&gt;&lt;H2&gt;When to use method=&quot;post&quot;?&lt;/H2&gt;&lt;p&gt;Information sent from a form with the POST method is invisible to others and   has no limits on the amount of information to send.&lt;/p&gt;&lt;p&gt;However, because the variables are not displayed in the URL, it is not   possible to bookmark the page.&lt;/p&gt;&lt;HR&gt;&lt;H2&gt;The PHP $_REQUEST Variable&lt;/H2&gt;&lt;p&gt;The predefined $_REQUEST variable contains the contents of both $_GET,   $_POST, and $_COOKIE.&lt;/p&gt;&lt;p&gt;The $_REQUEST variable can be used to collect form data sent with both the   GET and POST methods.&lt;/p&gt;&lt;H3&gt;Example&lt;/H3&gt;&lt;DIV&gt;  &lt;DIV&gt;Welcome &amp;lt;?php echo $_REQUEST[&quot;fname&quot;]; ?&amp;gt;!&amp;lt;br /&amp;gt;&lt;BR&gt;&lt;br /&gt;
    You are   &amp;lt;?php echo $_REQUEST[&quot;age&quot;]; ?&amp;gt; years old. &lt;/DIV&gt;&lt;/DIV&gt;&lt;BR&gt;</content><link rel='replies' type='application/atom+xml' href='http://allphpzone.blogspot.com/feeds/3576357015318775415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-post-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/3576357015318775415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8101614521919315001/posts/default/3576357015318775415'/><link rel='alternate' type='text/html' href='http://allphpzone.blogspot.com/2011/11/php-post-function.html' title='PHP $_POST Function'/><author><name>oh-freegame.blogspot.com</name><uri>http://www.blogger.com/profile/17668710958868608463</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>