Php variable
variable is needed at php.
In PHP a variable does not need to be declared before being set.
Variable can place every where at php ( must inside “<?php ?>” and before function used that variable)
Variable in php start with $ and followed first by word character (a-z).
PHP variable can not use space but can use “_ (under score) ”
Example variable in PHP :
- $username
- $password1
- $my_name
- $myword
Let’s try creating a variable with a string, and a variable with a number:
<?php
$first_text = "This is my first php";
$number1 = 16;
?>
For value number, we can write the number without “”, but for others like character value we must use “” like “This is my first php”
And don’t forget every variables must end with ;
Strings in PHP
String variables are used for values that contains character strings.
Below, the PHP script assigns the string “This is my first Php” to a variable called $text :
<?php
$text =”This is my first Php”;
echo “$text” ;
?>
and output for that code is
This is my first Php
Related post :

November 12th, 2008 at 11:37 pm
z0iygnxvypfslrb6
reply