<?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: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-9080835</id><updated>2011-12-14T19:11:36.279-08:00</updated><title type='text'>PHP Journal</title><subtitle type='html'>My syntax notes, tutorials and thoughts on PHP coding ... </subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9080835.post-110614577312388886</id><published>2005-01-19T06:34:00.000-08:00</published><updated>2005-01-19T06:46:03.736-08:00</updated><title type='text'>Take a Break, Solve a Puzzle</title><content type='html'>It is always good to relax after long hours of coding. You clear your mind, you think better, you feel better, and you WILL code better programs if you do not over-strain yourself.&lt;br /&gt;&lt;br /&gt;Here's a good &lt;strong&gt;word search puzzle&lt;/strong&gt; web site to visit ... &lt;a href='http://www.webvroom.com'&gt;http://www.webvroom.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Do remember to 'vroom' back to PHP after your break.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110614577312388886?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110614577312388886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110614577312388886' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110614577312388886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110614577312388886'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2005/01/take-break-solve-puzzle.html' title='Take a Break, Solve a Puzzle'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110087426808685684</id><published>2004-11-19T06:19:00.000-08:00</published><updated>2004-11-19T06:32:14.446-08:00</updated><title type='text'>PHP Form Trap</title><content type='html'>PHP are &lt;strong&gt;great&lt;/strong&gt; for processing input forms ... Just look at this form:&lt;br /&gt;&lt;br /&gt;&amp;#60;html&amp;#62;&lt;br /&gt;&amp;#60;body&amp;#62;&lt;br /&gt;&amp;#60;form action="process.php" method="post"&amp;#62;&lt;br /&gt;What is your name: &amp;#60;input name="username" type="text"&amp;#62;&amp;#60;br&amp;#62;&lt;br /&gt;What is your age: &amp;#60;input name="age" type="text"&amp;#62;&amp;#60;br&amp;#62;&lt;br /&gt;&amp;#60;input name="Submit" type="submit" value="Submit Now"&amp;#62;&lt;br /&gt;&amp;#60;/form&amp;#62;&lt;br /&gt;&amp;#60;/body&amp;#62;&lt;br /&gt;&amp;#60;/html&amp;#62;&lt;br /&gt;&lt;br /&gt;To get the submitted values, this code will suffice:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;echo("The user's name is " . $username);&lt;br /&gt;echo("The user's age is " . $age);&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;( Simply cool! ... You might be thinking already...)&lt;br /&gt;&lt;br /&gt;Now go on ... Run the code and see what you get ...&lt;br /&gt;&lt;br /&gt;Do you get this result?&lt;br /&gt;&lt;br /&gt;The user's name is John. (Assuming you entered Jack)&lt;br /&gt;The user's age is 23. (Assuming you entered 23)&lt;br /&gt;&lt;br /&gt;No? Do you get an &lt;strong&gt;error&lt;/strong&gt;? &lt;br /&gt;&lt;br /&gt;( Yep. What am I doing wrong? ... Are you wondering? )&lt;br /&gt;&lt;br /&gt;Let's see ... if you encounter the following error, you are not alone ...&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Notice: Undefined variable: username in ......\test.php on line 3&lt;br /&gt;Username is &lt;br /&gt;Notice: Undefined variable: age in ......\test.php on line 4&lt;br /&gt;Age is &lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Almost every PHP newbie suffers from this maddening experience. A simple form exercise turns out to be minutes (hopefully not hours ...) of debugging.&lt;br /&gt;&lt;br /&gt;Luckily for you, you won't suffer the same trauma.&lt;br /&gt;&lt;br /&gt;The reason why this error occur lies in the &lt;strong&gt;"php.ini"&lt;/strong&gt; file. &lt;br /&gt;&lt;br /&gt;Look for &lt;strong&gt;register_globals = off&lt;/strong&gt;. Turn it &lt;strong&gt;on&lt;/strong&gt; and try again.&lt;br /&gt;&lt;br /&gt;You should be popping champagne this time! Well let's not be estatic. &lt;br /&gt;Although it works for now, it might be better to &lt;strong&gt;turn it off&lt;/strong&gt; again.&lt;br /&gt;&lt;br /&gt;(Any reason why?) &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Security issue&lt;/strong&gt;. &lt;br /&gt;&lt;br /&gt;If someone create a bogus form with tonnes of input fields and send it to your php script, your script will end up with tonnes of landmines in the global register.&lt;br /&gt;&lt;br /&gt;Sounds bad enough?&lt;br /&gt;&lt;br /&gt;Remember to turn it off.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110087426808685684?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110087426808685684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110087426808685684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110087426808685684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110087426808685684'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-form-trap.html' title='PHP Form Trap'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110069489029130749</id><published>2004-11-17T04:33:00.000-08:00</published><updated>2004-11-17T04:34:50.290-08:00</updated><title type='text'>Function Calls at Runtime</title><content type='html'>It is possible to &lt;strong&gt;select the correct function&lt;/strong&gt; to call at run-time ... here's how:&lt;br /&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;function requestLogin() {&lt;br /&gt;&lt;br /&gt;print("Please login first.&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function welcomeUser() {&lt;br /&gt;&lt;br /&gt;print("Welcome to my homepage.&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function checkUser($userLogin) {&lt;br /&gt;&lt;br /&gt;global $runFunction;&lt;br /&gt;&lt;br /&gt;if ($userLogin) {&lt;br /&gt;&lt;br /&gt;$runFunction = "welcomeUser";&lt;br /&gt;&lt;br /&gt;} else {&lt;br /&gt;&lt;br /&gt;$runFunction = "requestLogin";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$runFunction();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$userLogin = true;&lt;br /&gt;&lt;br /&gt;checkUser($userLogin);&lt;br /&gt;&lt;br /&gt;$userLogin = false;&lt;br /&gt;&lt;br /&gt;checkUser($userLogin);&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;prints:&lt;br /&gt;&lt;br /&gt;Welcome to my homepage.&lt;br /&gt;Please login first.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110069489029130749?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110069489029130749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110069489029130749' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110069489029130749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110069489029130749'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/function-calls-at-runtime.html' title='Function Calls at Runtime'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110061304786938564</id><published>2004-11-16T05:49:00.000-08:00</published><updated>2004-11-17T04:40:04.403-08:00</updated><title type='text'>PHP Array Functions</title><content type='html'>Refer to the PHP manual for more details.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;is_array($array)&lt;/strong&gt; - Tests if $array is an array. Returns (true|false).&lt;br /&gt;&lt;strong&gt;array_merge()&lt;/strong&gt; - Combines 2 or more arrays. Returns combined array. (From PHP4 onwards)&lt;br /&gt;&lt;strong&gt;array_push()&lt;/strong&gt; - "Pushes" 1 or more items into an array.&lt;br /&gt;&lt;strong&gt;array_shift()&lt;/strong&gt; - "Pops" 1 item from an array. Returns item.&lt;br /&gt;&lt;strong&gt;array_slice()&lt;/strong&gt; - Duplicates portions of another array. Returns new array.&lt;br /&gt;&lt;strong&gt;sort()&lt;/strong&gt; - Sorts an array (either alphabetically or numerically depending on item datatype). Returns nothing.  &lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// Start with an array&lt;br /&gt;$cookbook1[] = "chicken pie";&lt;br /&gt;&lt;br /&gt;// add another recipe&lt;br /&gt;array_push($cookbook1, "durian cake");&lt;br /&gt;&lt;br /&gt;// show and remove the first recipe from cookbook&lt;br /&gt;print(array_shift($cookbook1) . "&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;// create another array&lt;br /&gt;$cookbook2 = array ("apple pie", "orange pie", "milkshake");&lt;br /&gt;&lt;br /&gt;// merge both cookbooks&lt;br /&gt;$cookbook3 = array_merge($cookbook1, $cookbook2);&lt;br /&gt;&lt;br /&gt;// sort the cookbook&lt;br /&gt;sort($cookbook3);&lt;br /&gt;&lt;br /&gt;// print the cookbook&lt;br /&gt;foreach ($cookbook3 as $recipe) {&lt;br /&gt;	print("$recipe . &lt;br&gt;");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110061304786938564?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110061304786938564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110061304786938564' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110061304786938564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110061304786938564'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-array-functions.html' title='PHP Array Functions'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040314585888778</id><published>2004-11-13T19:31:00.000-08:00</published><updated>2004-11-13T19:32:25.856-08:00</updated><title type='text'>Variable within Another Variable</title><content type='html'>A quick quiz ...&lt;br /&gt;&lt;br /&gt;Is this code legal? ...&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$fruit = "apple";&lt;br /&gt;$temp = "fruit";&lt;br /&gt;&lt;br /&gt;print($$temp);&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;If you answered "Yes", congrats ... you are right. If you said "No", better luck next time! &lt;br /&gt;&lt;br /&gt;Read on!&lt;br /&gt;&lt;br /&gt;$$temp actually evaluates to $fruit. Hence, the code is legal and the word "apple" is printed.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040314585888778?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040314585888778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040314585888778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040314585888778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040314585888778'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/variable-within-another-variable.html' title='Variable within Another Variable'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040299856989946</id><published>2004-11-13T19:29:00.000-08:00</published><updated>2004-11-16T05:41:43.113-08:00</updated><title type='text'>PHP if ... elseif ... else ...</title><content type='html'>Sample code:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$temperature = 0;	// degrees celsius&lt;br /&gt;&lt;br /&gt;if ($temperature == 0) {&lt;br /&gt;	print("I am freezing.");&lt;br /&gt;} elseif ($temperature == 100) {&lt;br /&gt;	print("I am boiling.");&lt;br /&gt;} else {&lt;br /&gt;	print("In between boiling and freezing points.");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;prints&lt;br /&gt;&lt;br /&gt;I am freezing.&lt;br /&gt;&lt;br /&gt;Shortcut using the &lt;strong&gt;ternary operator&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;If there are only two possible alternatives, you can use the ternary operator as a shortcut:&lt;br /&gt;&lt;br /&gt;eg.&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$reply = 1;&lt;br /&gt;&lt;br /&gt;if ($reply == 1) {&lt;br /&gt;	$result = "yes";&lt;br /&gt;} else {&lt;br /&gt;	$result = "no";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print($result);&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;is the same as :&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$reply = 1;&lt;br /&gt;$result = (($reply == 1)? "yes" : "no");&lt;br /&gt;print($result);&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040299856989946?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040299856989946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040299856989946' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040299856989946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040299856989946'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-if-elseif-else.html' title='PHP if ... elseif ... else ...'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040295046056373</id><published>2004-11-13T19:27:00.000-08:00</published><updated>2004-11-17T04:29:45.513-08:00</updated><title type='text'>"Pass By Value" versus "Pass By Reference"</title><content type='html'>PHP supports &lt;strong&gt;"pass by reference"&lt;/strong&gt; variables by prefixing a variable with an ampersand(&amp;)(PHP4 onwards ...). By default, variables are &lt;strong&gt;"passed by value"&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;e.g. &lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$varA = "apple";&lt;br /&gt;print($varA . "&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;$varB = "orange";&lt;br /&gt;print($varB . "&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;$varC = "pineapple";&lt;br /&gt;print($varC . "&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;$varC = &amp;$varA;	// reference $varA&lt;br /&gt;print($varC . "&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;$varA = "watermelon";&lt;br /&gt;print($varC . "&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;$varC = &amp;$varB;	// reference $varB&lt;br /&gt;print($varC . "&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;$varC = $varA;		// copy of $varA's value&lt;br /&gt;print($varC . "&lt;br&gt;");&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;Prints results:&lt;br /&gt;&lt;br /&gt;apple&lt;br /&gt;orange&lt;br /&gt;pineapple&lt;br /&gt;apple&lt;br /&gt;watermelon&lt;br /&gt;orange&lt;br /&gt;watermelon&lt;br /&gt;&lt;br /&gt;To pass a &lt;strong&gt;variable by reference to a function&lt;/strong&gt;, do this:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;function passToFunction1(&amp;$arg1) {&lt;br /&gt;&lt;br /&gt;// ...&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;passToFunction1($varByRef);&lt;br /&gt;?&amp;#62;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040295046056373?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040295046056373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040295046056373' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040295046056373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040295046056373'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/pass-by-value-versus-pass-by-reference.html' title='&quot;Pass By Value&quot; versus &quot;Pass By Reference&quot;'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040269215794009</id><published>2004-11-13T19:22:00.000-08:00</published><updated>2004-11-13T19:24:52.156-08:00</updated><title type='text'>Looping in PHP</title><content type='html'>There are &lt;strong&gt;2&lt;/strong&gt; standard types of &lt;strong&gt;while loops&lt;/strong&gt;. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Type 1: while loop&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;eg. &lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$x = 0;&lt;br /&gt;while ($x &amp;#60; 10) {&lt;br /&gt;	// do something&lt;br /&gt;	$x++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;The conditional test is evaluated &lt;strong&gt;BEFORE&lt;/strong&gt; the code block is executed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Type 2: do ... while loop&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;eg. &lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$x = 0;&lt;br /&gt;do {&lt;br /&gt;	// do something&lt;br /&gt;	$x++;&lt;br /&gt;} while ($x &amp;#60; 10); &lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;The conditional test is evaluated &lt;strong&gt;AFTER&lt;/strong&gt; the code block is executed.&lt;br /&gt;This means that the code block is run a minimum of 1 time.&lt;br /&gt;&lt;br /&gt;break and continue statements can affect looping if added in the code block.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;break;&lt;/strong&gt; abandons the while loop, and continues to the next statement.&lt;br /&gt;&lt;strong&gt;continue;&lt;/strong&gt; skips the current loop, but continues with the next loop.&lt;br /&gt;&lt;br /&gt;eg.&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$x = 0;&lt;br /&gt;while ($x &amp;#60; 10) {&lt;br /&gt;	if ($x == 5) {&lt;br /&gt;		$x++;&lt;br /&gt;		continue;&lt;br /&gt;	}&lt;br /&gt;	if ($x == 8) {&lt;br /&gt;		break;&lt;br /&gt;	}&lt;br /&gt;	print($x . "&amp;#60;br&amp;#62;");&lt;br /&gt;	$x++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;prints:&lt;br /&gt;&lt;br /&gt;0&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;6&lt;br /&gt;7&lt;br /&gt;&lt;br /&gt;5 is missing as that iteration is skipped by continue;&lt;br /&gt;8,9 are missing as break; terminated the loop when $x equals 8.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;for loop statement:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;eg. &lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;for ($x=0; $x&amp;#60;10; $x++) {&lt;br /&gt;	if ($x == 5) {&lt;br /&gt;		continue;&lt;br /&gt;	}&lt;br /&gt;	if ($x == 8) {&lt;br /&gt;		break;&lt;br /&gt;	}&lt;br /&gt;	print($x . "&amp;#60;br&amp;#62;");&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;prints the same results as above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040269215794009?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040269215794009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040269215794009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040269215794009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040269215794009'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/looping-in-php.html' title='Looping in PHP'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040252906437934</id><published>2004-11-13T19:21:00.000-08:00</published><updated>2004-11-16T05:43:53.660-08:00</updated><title type='text'>PHP Switch</title><content type='html'>Sample code:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;switch ($temperature) {&lt;br /&gt;	&lt;br /&gt;&lt;br /&gt;	case 0: print("I am freezing.");&lt;br /&gt;		break;&lt;br /&gt;		&lt;br /&gt;	case 100: print("I am boiling.");&lt;br /&gt;		  break;&lt;br /&gt;		  &lt;br /&gt;	default: print("In between boiling and freezing points.");&lt;br /&gt;	&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;Note the "break" statement after every case statement. If omitted, "fall-through" will occur.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040252906437934?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040252906437934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040252906437934' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040252906437934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040252906437934'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-switch.html' title='PHP Switch'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040217845320048</id><published>2004-11-13T19:15:00.000-08:00</published><updated>2004-11-13T19:16:18.453-08:00</updated><title type='text'>PHP Constants</title><content type='html'>How to &lt;strong&gt;define a PHP constant&lt;/strong&gt;?&lt;br /&gt;&lt;br /&gt;Use the function: &lt;strong&gt;define("CONSTANT_IN_UPPERCASE", value);&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;eg.&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;define("CAR_WEIGHT", 100);&lt;br /&gt;&lt;br /&gt;print("This car weighs ".CAR_WEIGHT." kg.");&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;displays&lt;br /&gt;&lt;br /&gt;This car weighs 100 kg.&lt;br /&gt;&lt;br /&gt;Note the missing $ sign before the constant name.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040217845320048?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040217845320048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040217845320048' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040217845320048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040217845320048'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-constants.html' title='PHP Constants'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040205432906917</id><published>2004-11-13T19:13:00.000-08:00</published><updated>2004-11-13T19:14:14.330-08:00</updated><title type='text'>PHP Tips</title><content type='html'>1. Choose &lt;strong&gt;descriptive but concise&lt;/strong&gt; variable names.&lt;br /&gt;2. Use &lt;strong&gt;parentheses&lt;/strong&gt; to clarify operations.&lt;br /&gt;3. Always end the statement with a &lt;strong&gt;semicolon&lt;/strong&gt;;&lt;br /&gt;4. &lt;strong&gt;CONSTANTS&lt;/strong&gt; names should be in &lt;strong&gt;UPPER-CASE&lt;/strong&gt; by convention.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040205432906917?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040205432906917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040205432906917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040205432906917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040205432906917'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-tips.html' title='PHP Tips'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040189785273236</id><published>2004-11-13T19:07:00.000-08:00</published><updated>2004-11-13T19:11:37.853-08:00</updated><title type='text'>Fun with Operations</title><content type='html'>I hope you have used a calculator before ... If not, go buy one and work on it ... it makes the following explanation much clearer ...&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Maths Operation&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Add: 		+&lt;br /&gt;Subtract: 	-&lt;br /&gt;Divide: 	/&lt;br /&gt;Multiply: 	*	(not 'x' as on a calculator;)&lt;br /&gt;Modulus: 	%&lt;br /&gt;Assignment: 	=&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;String Operation&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Concatenate: 	.	(yes ... it is a 'dot')&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Shortforms&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Add and Assign:			+=&lt;br /&gt;Subtract and Assign:		-=&lt;br /&gt;Divide and Assign:		/=&lt;br /&gt;Multiply and Assign:		*=&lt;br /&gt;Modulus and Assign:		%=&lt;br /&gt;Concatenate and Assign:		.=&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Comparison Operation&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Equal:				==&lt;br /&gt;Not equal:			!=&lt;br /&gt;Equal and same datatype:	===&lt;br /&gt;Greater:			&amp;#62;&lt;br /&gt;Greater than or equal:		&amp;#62;=&lt;br /&gt;Less than:			&amp;#60;&lt;br /&gt;Less than or equal:		&amp;#60;=&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Logical Operations&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;OR:				||&lt;br /&gt;AND:				&amp;&amp;&lt;br /&gt;NOT:				!&lt;br /&gt;XOR:				xor	(... ONLY IF either left or right operand is true.)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Pre-Increment&lt;/strong&gt;:			++$var&lt;br /&gt;&lt;strong&gt;Pre-Decrement&lt;/strong&gt;:			--$var&lt;br /&gt;&lt;strong&gt;Post-Increment&lt;/strong&gt;:			$var++&lt;br /&gt;&lt;strong&gt;Post-Decrement&lt;/strong&gt;:			$var--&lt;br /&gt;&lt;br /&gt;eg.&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$left = true;&lt;br /&gt;$right = false;&lt;br /&gt;&lt;br /&gt;$result = ($left xor $right);&lt;br /&gt;&lt;br /&gt;print($result);&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;What will be the result? Try it out! (Result is "1".)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040189785273236?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040189785273236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040189785273236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040189785273236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040189785273236'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/fun-with-operations.html' title='Fun with Operations'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040155516810429</id><published>2004-11-13T19:05:00.000-08:00</published><updated>2004-11-13T19:05:55.166-08:00</updated><title type='text'>Include PHP code in HTML </title><content type='html'>PHP code can be added to any part of a HTML document.&lt;br /&gt;&lt;br /&gt;For &lt;strong&gt;ease of maintenance&lt;/strong&gt;, you can do the following:&lt;br /&gt;&lt;br /&gt;&amp;#60;!-- start of html file --&amp;#62;&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// Put in as much PHP code at the top of the document as possible. &lt;br /&gt;$title = "This is the title of the webpage";&lt;br /&gt;$body = "This is the body of the webpage";&lt;br /&gt;&lt;br /&gt;// and more code ...&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;&amp;#60;html&amp;#62;&lt;br /&gt;&amp;#60;head&amp;#62;&lt;br /&gt;&amp;#60;title&amp;#62;&amp;#60;?php print($title); ?&amp;#62;&amp;#60;/title&amp;#62;&lt;br /&gt;&amp;#60;/head&amp;#62;&lt;br /&gt;&amp;#60;body&amp;#62;&lt;br /&gt;&lt;br /&gt;&amp;#60;?php print($body); ?&amp;#62;&lt;br /&gt;&lt;br /&gt;&amp;#60;/body&amp;#62;&lt;br /&gt;&amp;#60;/html&amp;#62;&lt;br /&gt;&lt;br /&gt;&amp;#60;!-- end of html file --&amp;#62;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040155516810429?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040155516810429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040155516810429' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040155516810429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040155516810429'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/include-php-code-in-html.html' title='Include PHP code in HTML '/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040144275611513</id><published>2004-11-13T19:03:00.000-08:00</published><updated>2004-11-17T04:25:00.043-08:00</updated><title type='text'>PHP Associative Arrays</title><content type='html'>How to &lt;strong&gt;create an associative array&lt;/strong&gt; ...&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$car = array ("weight"=&amp;#62;"100kg", "year"=&amp;#62;"2004", "price"=&amp;#62;"7000");&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;Alternative code:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$car["weight"] = "100kg"; &lt;br /&gt;$car["year"] = "2004"; &lt;br /&gt;$car["price"] = "7000";&lt;br /&gt;$car["discount rebate"] = "12";&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;To display the items in an array, do this:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// display car properties&lt;br /&gt;print($car["price"]."&amp;#60;br&amp;#62;");&lt;br /&gt;&lt;br /&gt;// display all car properties&lt;br /&gt;foreach ($car as $property=&amp;#62;$value) {&lt;br /&gt;	print($property . " is " . $value . "&amp;#60;br&amp;#62;");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;How to &lt;strong&gt;sort an associative array&lt;/strong&gt; ...&lt;br /&gt;&lt;br /&gt;asort() - Sorts an associative array by value. Returns nothing.&lt;br /&gt;ksort() - Sorts an associative array by key. Returns nothing.&lt;br /&gt;&lt;br /&gt;eg. &lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$fruittrolley = array ("apple"=&amp;#62;"100", "orange"=&amp;#62;"20", "pear"=&amp;#62;"30");&lt;br /&gt;&lt;br /&gt;asort($fruittrolley);&lt;br /&gt;&lt;br /&gt;print("After asort: &amp;#60;br&amp;#62;");&lt;br /&gt;&lt;br /&gt;foreach ($fruittrolley as $fruit=&amp;#62;$no) {&lt;br /&gt;	print("There are $no ${fruit}s.&amp;#60;br&amp;#62;");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ksort($fruittrolley);&lt;br /&gt;&lt;br /&gt;print("After ksort: &amp;#60;br&amp;#62;");&lt;br /&gt;&lt;br /&gt;foreach ($fruittrolley as $fruit=&amp;#62;$no) {&lt;br /&gt;	print("There are $no ${fruit}s.&amp;#60;br&amp;#62;");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;prints:&lt;br /&gt;&lt;br /&gt;After asort: &lt;br /&gt;There are 20 oranges.&lt;br /&gt;There are 30 pears.&lt;br /&gt;There are 100 apples.&lt;br /&gt;After ksort: &lt;br /&gt;There are 100 apples.&lt;br /&gt;There are 20 oranges.&lt;br /&gt;There are 30 pears.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040144275611513?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040144275611513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040144275611513' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040144275611513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040144275611513'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-associative-arrays.html' title='PHP Associative Arrays'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110040136912309669</id><published>2004-11-13T19:01:00.000-08:00</published><updated>2004-11-13T19:02:49.123-08:00</updated><title type='text'>PHP Arrays</title><content type='html'>How to &lt;strong&gt;create an array &lt;/strong&gt;...&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$fruitbasket = array ("Apple", "Orange", "Pear", "Mango", "Strawberry");&lt;br /&gt;$fruitbasket[] = "Rambutan"; // add a fruit to the list&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;Alternatively, you can use the following code:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;$fruitbasket[] = "Apple";&lt;br /&gt;$fruitbasket[] = "Orange";&lt;br /&gt;$fruitbasket[] = "Pear";&lt;br /&gt;$fruitbasket[] = "Mango";&lt;br /&gt;$fruitbasket[] = "Strawberry";&lt;br /&gt;$fruitbasket[] = "Rambutan";&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;Note: Use &lt;strong&gt;count($arrayName)&lt;/strong&gt; to count the number of items in the array.&lt;br /&gt;&lt;br /&gt;To display the items in an array, do this:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// display fruits in fruitbasket&lt;br /&gt;for($i=0;$i&amp;#60;count($fruitbasket);$i++) {&lt;br /&gt;	print($fruitbasket[$i]."&amp;#60;br&amp;#62;");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;Alternatively, you can use the following code:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// display fruits in fruitbasket&lt;br /&gt;foreach ($fruitbasket as $item) {&lt;br /&gt;	print($item."&amp;#60;br&amp;#62;");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110040136912309669?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110040136912309669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110040136912309669' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040136912309669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110040136912309669'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-arrays.html' title='PHP Arrays'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110018436907331926</id><published>2004-11-11T06:45:00.000-08:00</published><updated>2004-11-12T04:35:29.886-08:00</updated><title type='text'>Punctuate your PHP</title><content type='html'>Always end your PHP statement with a &lt;strong&gt;semicolon&lt;/strong&gt; (;)&lt;br /&gt;&lt;br /&gt;Now, what happens if you write bad grammar ...&lt;br /&gt;&lt;br /&gt;PHP parser replies with an typical &lt;strong&gt;"unexpected T_PRINT"&lt;/strong&gt; error message:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Parse error: parse error, unexpected T_PRINT in xxxx\yyyyy\zzzzz\testfile.php on line 4&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;So remember your semicolons;) even if it is the only statement in the block.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110018436907331926?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110018436907331926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110018436907331926' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018436907331926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018436907331926'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/punctuate-your-php.html' title='Punctuate your PHP'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110018422271812991</id><published>2004-11-11T06:41:00.001-08:00</published><updated>2004-11-12T05:29:04.693-08:00</updated><title type='text'>HelloWorld in PHP</title><content type='html'>Since this is a standard program in any language ... here's the PHP version ...&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;print("Hello World");&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;If you compare this with the JSP version of "Hello World" below, you will see why &lt;strong&gt;PHP is so MUCH MORE convenient to code&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;import javax.servlet.*;&lt;br /&gt;import javax.servlet.http.*;&lt;br /&gt;&lt;br /&gt;public class HelloWorld extends HttpServlet {&lt;br /&gt;&amp;nbsp;&amp;nbsp;public void doGet(HttpServletRequest req, HttpServletResponse res)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throws ServletException, IOException {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;res.getWriter().println("Hello World");&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110018422271812991?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110018422271812991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110018422271812991' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018422271812991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018422271812991'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/helloworld-in-php.html' title='HelloWorld in PHP'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110018431581313974</id><published>2004-11-11T06:41:00.000-08:00</published><updated>2004-11-11T06:45:15.813-08:00</updated><title type='text'>PHP Tag Styles</title><content type='html'>There are &lt;strong&gt;4 ways&lt;/strong&gt; of specifying PHP code:&lt;br /&gt;&lt;br /&gt;1. The &lt;strong&gt;usual way&lt;/strong&gt; ...&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;// ... PHP code goes here&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;2. The &lt;strong&gt;shortcut&lt;/strong&gt; ...&lt;br /&gt;&lt;br /&gt;&amp;#60;? /* PHP code goes here ... Beware if you have XML code in same page */ ?&amp;#62;&lt;br /&gt;&lt;br /&gt;3. The &lt;strong&gt;long-winded way&lt;/strong&gt; ...&lt;br /&gt;&lt;br /&gt;&amp;#60;script language="php"&amp;#62;&lt;br /&gt;&lt;br /&gt;// ... PHP code goes here&lt;br /&gt;&lt;br /&gt;&amp;#60;/script&amp;#62;&lt;br /&gt;&lt;br /&gt;4. And finally, the &lt;strong&gt;ASP way&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&amp;#60;%&lt;br /&gt;&lt;br /&gt;// ... PHP code goes here&lt;br /&gt;&lt;br /&gt;%&amp;#62;&lt;br /&gt;&lt;br /&gt;To discourage you from using the ASP way, asp tags are de-activated by default. You need to change the php.ini file to enable it. Look for asp_tags=off. Turn it on.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110018431581313974?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110018431581313974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110018431581313974' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018431581313974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018431581313974'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-tag-styles.html' title='PHP Tag Styles'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110018407377061916</id><published>2004-11-11T06:39:00.000-08:00</published><updated>2004-11-11T06:41:13.770-08:00</updated><title type='text'>Best PHP Editors</title><content type='html'>Which is your &lt;strong&gt;favorite&lt;/strong&gt; PHP editor?&lt;br /&gt;&lt;br /&gt;1. Dreamweaver MX&lt;br /&gt;2. TextPad&lt;br /&gt;3. Notepad&lt;br /&gt;4. Simple Text&lt;br /&gt;5. BBEdit&lt;br /&gt;6. HTMLKit&lt;br /&gt;7. Emacs&lt;br /&gt;8. PHP Studio&lt;br /&gt;&lt;br /&gt;My vote goes to TextPad. It is simple. It is fast! It is really good!&lt;br /&gt;&lt;br /&gt;Cast your vote now!&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110018407377061916?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110018407377061916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110018407377061916' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018407377061916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018407377061916'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/best-php-editors.html' title='Best PHP Editors'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110018332210062033</id><published>2004-11-11T06:27:00.000-08:00</published><updated>2004-11-11T06:28:42.100-08:00</updated><title type='text'>PHP: The evolution</title><content type='html'>Rasmus Lerdorf created the &lt;strong&gt;Personal Home Page Tools&lt;/strong&gt; in 1994. (PHP)&lt;br /&gt;&lt;br /&gt;A group of developers created a new parser and improved on PHP. (&lt;strong&gt;PHP3&lt;/strong&gt;)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;PHP4&lt;/strong&gt; was released next, with the Zend engine at its core.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;PHP5&lt;/strong&gt; should be out by now ...&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110018332210062033?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110018332210062033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110018332210062033' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018332210062033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018332210062033'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-evolution.html' title='PHP: The evolution'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110018320840641366</id><published>2004-11-11T06:24:00.000-08:00</published><updated>2004-11-11T06:26:48.406-08:00</updated><title type='text'>Why I chose PHP</title><content type='html'>1. PHP is MUCH &lt;strong&gt;easier&lt;/strong&gt; to learn compared to other web languages.&lt;br /&gt;&lt;br /&gt;2. It takes much &lt;strong&gt;fewer lines of code&lt;/strong&gt; to produce the same results (i.e. Try coding a "HelloWorld" program in JSP, ASP and&lt;br /&gt;PHP and you see what I mean).&lt;br /&gt;&lt;br /&gt;3. It is &lt;strong&gt;free&lt;/strong&gt;. So is MySQL, the database. Ah! Not forgetting Apache, the web server. And Linux! Your wallet should be happy!&lt;br /&gt;&lt;br /&gt;4. Powerful. PHP has &lt;strong&gt;many useful functions&lt;/strong&gt; ready for use. There is no need to re-write the code to access the database etc.&lt;br /&gt;&lt;br /&gt;5. PHP runs on &lt;strong&gt;Windows, Linux, Unix&lt;/strong&gt; etc.&lt;br /&gt;&lt;br /&gt;6.&lt;strong&gt; Open-source&lt;/strong&gt; and mainstream ... it is easier to find help if you run into problems.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110018320840641366?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110018320840641366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110018320840641366' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018320840641366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110018320840641366'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/why-i-chose-php.html' title='Why I chose PHP'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110000907413458134</id><published>2004-11-09T05:59:00.000-08:00</published><updated>2004-11-17T04:16:50.860-08:00</updated><title type='text'>PHP Variables and Datatypes</title><content type='html'>What is a variable? (You are kidding ... aren't you?)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to set a variable in PHP?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is how you do it ...&lt;br /&gt;&lt;br /&gt;$variableName = value;&lt;br /&gt;&lt;br /&gt;Letters, numbers, underscore (_) are &lt;strong&gt;allowed&lt;/strong&gt; in variable names.&lt;br /&gt;Spaces ( ), non-alphanumeric characters are &lt;strong&gt;NOT allowed&lt;/strong&gt; in variable names.&lt;br /&gt;&lt;br /&gt;Variable names &lt;strong&gt;CANNOT&lt;/strong&gt; start with a number!&lt;br /&gt;&lt;br /&gt;Here are the &lt;strong&gt;basic datatypes &lt;/strong&gt;in PHP. The value of a variable can be one of these datatypes:&lt;br /&gt;&lt;br /&gt;1. Integer eg. 12345&lt;br /&gt;&lt;br /&gt;2. Double eg. 123.45&lt;br /&gt;&lt;br /&gt;3. String eg. 'string' or "string"&lt;br /&gt;&lt;br /&gt;4. Boolean either true or false (PHP4 onwards)&lt;br /&gt;&lt;br /&gt;Note that &lt;strong&gt;PHP does not impose strong type checking&lt;/strong&gt;. (i.e. A variable may take on different datatypes at different points of execution.)&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;// Defines an integer&lt;br /&gt;$noOfPeople = 12345; &lt;br /&gt;&lt;br /&gt;// Defines an double&lt;br /&gt;$priceOfProduct = 123.45; &lt;br /&gt;&lt;br /&gt;// Defines a boolean&lt;br /&gt;$userHasRegistered = true;&lt;br /&gt;&lt;br /&gt;// Defines a string&lt;br /&gt;$welcomeMessage = "Hello World";&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;br /&gt;&lt;br /&gt;(... You mean you really don't know what a variable is? ... hmmm ... well ... treat it as a box containing a value which may vary. )&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110000907413458134?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110000907413458134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110000907413458134' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110000907413458134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110000907413458134'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-variables-and-datatypes.html' title='PHP Variables and Datatypes'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110000603961181757</id><published>2004-11-09T05:11:00.000-08:00</published><updated>2004-11-09T05:54:40.996-08:00</updated><title type='text'>PHP Version</title><content type='html'>All the code snippets in this blog have been tested with&lt;strong&gt; PHP Version 4.3.8&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;Now how do you know which version you are running?&lt;br /&gt;&lt;br /&gt;Simple ...&lt;br /&gt;&lt;br /&gt;Run this line in your code:&lt;br /&gt;&lt;br /&gt;&amp;#60;?php&lt;br /&gt;&lt;br /&gt;phpinfo();&lt;br /&gt;&lt;br /&gt;?&amp;#62;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110000603961181757?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://phpjournal.blogspot.com/feeds/110000603961181757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9080835&amp;postID=110000603961181757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110000603961181757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110000603961181757'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/php-version.html' title='PHP Version'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9080835.post-110000466759133309</id><published>2004-11-09T04:44:00.000-08:00</published><updated>2004-11-12T05:59:32.693-08:00</updated><title type='text'>How to comment in PHP</title><content type='html'>There are &lt;strong&gt;3 ways of commenting in PHP&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;# This line is commented out (single line comment).&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;// so is this line (another single line comment).&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;&lt;br /&gt;Is this line a comment? Make a guess! ( ... Alright, it is a multi-line comment.)&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9080835-110000466759133309?l=phpjournal.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110000466759133309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9080835/posts/default/110000466759133309'/><link rel='alternate' type='text/html' href='http://phpjournal.blogspot.com/2004/11/how-to-comment-in-php.html' title='How to comment in PHP'/><author><name>cloudnine</name><uri>http://www.blogger.com/profile/10621457486318098750</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>
