For storing different types of values, we can use variables
- variables in PHP start with this $ dollar symbol.
- Name of a variable in php must start with a letter or with this _ symbol.
- Name of a variable in php must contain only alpha-numeric characters and underscores(abc...z, ABC...Z, 012...9, _)
- Name of a variable in php should not contain spaces, it will be mistake. if your variable contains more then one word, you can use separator($my_name)
- A variable does not need to declare value type, Php will automatically converts this variable to the correct data type.
$variable_name = "Myname";
declare text string type variable:
$variable_name = 5;
after decleration a variable, you can use each time you want in your script variables in php
<html> <body> <?php $country = "Canada" echo $country; ?> </body> </html> |
The result is :
Canada |
echo print the value of the $country variable.
Комментариев нет:
Отправить комментарий