HOME
PHP
Introduction Php Installation
PHP Basic Scripts
PHP variables
PHP operators
PHP Conditional statement
PHP functions
PHP Arrays
PHP Objects & classes
PHP with Forms
PHP Files
PHP With Database
PHP session
PHP cookies
PHP Regular Expressions
PHP Server Environment
PHP Graphics
PHP Advance
|
PHP Variables
Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.
Variable names follow the same rules as other labels in PHP. ay a doller $ sign the .a variable is a special container
that you can define to hold a value.
the following code defines spome legal variables
$b;
$2456;
$shoooooooop;
$b_a_c;
Dynamic variables
$usename="john";
$address="4240 S 400 w";
note:
- Remember that semicolon(;) is used at the end of the PHP statement.
- A variable can hold numbers,strings,characters,objects,arrays,or boolenas
- The content of the variable can be changed any time
| |
example 1
| output
Hello World |
|
|
output
In this example the 2 variables concatenate as
welcome To freewebschools
|
|
|
|