Saturday, 26 January 2013

PHP Tutorial : Chapter 2 . PHP Syntax and variables (Part 1)

Firstly let me mention something :- Cookies for you c/c++/java programmers or anyone with prior coding experience , for php will seem just like a walk in the park to you guys !!  For others or for first timers , don't worry , PHP is well , rather easy !!

We assign variables in php , in the following manner :-
$var = 1 ;
$str ="This is a string" ;

or just simply :-

$var ;

Confused c/c++/java programmers ? No int , no float , in other words no type declaration ? Well php does not need any type declaration , it's done automatically !!

The following things should be kept in mind about php's syntax :-

1) It is case-sensitive .
2) All statements should end in semi-colon .
3) White spaces are not taken into consideration . For eg :- $x= 2 + 2 ; is the same as $x=2+2;

No comments:

Post a Comment

Post a Comment