PHP Variables
Varible is a memory store where values are stored. All the variables in PHP start with $ sign. Therefore, define variable as follows:
|
<?php $variable = "Hello World!"; $number = 1; $result = 1 + $number; print $result; ?> |
PHP variables does not require variables to be declared before being used.
The naming convention to PHP follows following rules:
1. PHP variables are alphanumeric and can include characers(a-z, A-Z), underscore and numbers (0-9).
2. PHP variables can be separated with underscore (_). Normally, you would write a variable as $first_name, $second_name. You can also follow java like convention when defining a variable as $firstName, $secondName with second part starting with a capital letter.

Recent comments
22 weeks 4 days ago
23 weeks 1 day ago
23 weeks 1 day ago
23 weeks 3 days ago
24 weeks 1 day ago
26 weeks 2 days ago
29 weeks 2 days ago
32 weeks 1 day ago
32 weeks 6 days ago
33 weeks 4 days ago