IT SOLUTIONS
Your TECHNOLOGY partner! 
 
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post:

Enter your name and security key.

Your Name:
Today's security key = P224A
Enter key:
Write a Comment...

Commenting on...

[View/Review Post]
Title: PHP Code Blocks ({ })
By: Mike Prestwood

Languages Focus: Code Blocks

The rules for code blocks within a language dictate where you can declare variables, how you "bracket" code, etc.

PHP Code Blocks

In .PHP html pages, you embed PHP code between <?PHP and ?>.

For PHP, JavaScript, Java,and C++, I prefer to put the first { at the end of the first line of the code block as in the example above because I see morePHP codeformatted that way (and on PHP.Net).

PHP Alternative Syntax

Although I don't like to use it, PHP offers an alternative syntax for if, while, for, foreach, and switch. These code blocks are surrounded by statement ending keywords that all use End with camel caps such as endif, endwhile, endfor, endforeach,and endswitch.

<?PHP
$x = "Yes";
//Simple if
If ($x == "Yes")
echo "hello world";
 
//If with a block of code.
If ($x == "Yes") {
echo "Hello world";
  echo "I am a PHP coder!";
}
?>
-
  Load Time=less than 1 second.
 
Print This

KB Post Options:
-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


©1995-2013 Prestwood IT Solutions.   [Security & Privacy]   Made in the U.S.A..   No H1-B.   No offshoring.