Showing posts with label Variables in PHP. Show all posts
Showing posts with label Variables in PHP. Show all posts

Wednesday, January 22, 2014

Variables in PHP


Variables are used for storing a values, like text strings, numbers or arrays.
When a variable is declared, it can be used over and over again in your script.
All variables in PHP start with a $ sign symbol.
The correct way of declaring a variable in PHP:
$var_name = value;
New PHP programmers often forget the $ sign at the beginning of the variable. In that case it will not work.
creating a variable containing a string, and a variable containing a number:
<?php
$txt="Hello World!";
$x=16;
?>