Friday, 11 January 2013

PHP is case sensitive:

PHP is case sensitive:


Yeah it is true that PHP is a case sensitive language. Try out following example:
<html>
<body>
 <? $capital = 67; print("Variable capital is $capital<br>");
print("Variable CaPiTaL is $CaPiTaL<br>");
?>
</body>
 </html>

This will produce following result:

Variable capital is 67
Variable CaPiTaL is
Statements are expressions terminated by semicolons:

A statement in PHP is any expression that is followed by a semicolon (;).Any sequence of valid PHP statements that is enclosed by the PHP tags is a valid PHP program. Here is a typical statement in PHP, which in this case assigns a string of characters to a variable called $greeting:

$greeting = "Welcome to PHP!";

Expressions are combinations of tokens:
The smallest building blocks of PHP are the indivisible tokens, such as numbers (3.14159), strings (.two.), variables ($two), constants (TRUE), and the special words that make up the syntax of PHP itself like if, else, while, for and so forth

Braces make blocks:

Although statements cannot be combined like expressions, you can always put a sequence of statements anywhere a statement can go by enclosing them in a set of curly braces.

Here both statements are equivalent:

if (3 == 2 + 1)
print("Good - I haven't totally lost my mind.<br>");
if (3 == 2 + 1)
{ print("Good - I haven't totally");
print("lost my mind.<br>");
 }












No comments:

Post a Comment