Spawnfestis Dev. blog

PHP while & variable declaring

Posted by: spawnfestis on: March 24, 2009

Commented codesnippet for practicing PHP as a beginner.
Includes while-looping and variable declaring.
This helped me to understand PHP-syntax at it’s most basic level, but hey, got to start somewhere ;)

<?php // PHP start tag.
// Declaration in PHP
$i = 0; // Just a variable, you don’t need to assign a data type in PHP!

while($i < 5){ // Easy while loop, works like with C# or any other larger programming language
echo “Yahoo!
“; // Just like printf() or std::cout
$i++;
}

?>; // End tag, stop the PHP script!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Blog Stats

  • 3,875 hits
Follow

Get every new post delivered to your Inbox.