PHP Programming 101

May 29th, 2008

PHP BASIC CODING (cont…)

(cont…)
III. PHP Variables

$variablename=value;

Variables are used for storing values such as text string or arrays. And all variables in PHP starts with a ($) dollar sign. There are various rules to be follow before naming a variable. 1) A variable name must start with a letter or an underscore. 2) A variable name can only contain alpha-numeric characters and underscores. Special characters are not allowed. 3) A variable name should not contain spaces.

IV.PHP Strings

$wrd=”Hello World”;
print $wrd;

Strings variables are used for values that contain character strings. The only operator that can be used on string is concatenation denoted by the sign (.) period.

$wrd1=”Hello World”;
$wrd2=”Good day”;
print $wrd1.”".$wrd2

You can count the nos. of string with the function strlen().

Print strlen(”HelloWorld and GoodDay”);

to be continued…

php-designer3php-editorscom.jpg

image source: www.php-editors.com

Comments are closed.

Sorry, the comment form is closed at this time.

Bad Behavior has blocked 119 access attempts in the last 7 days.