Press "Enter" to skip to content

phpvariable

PHP Variable

The variable is temporary area which hold the information.

Example for for PHP Variable

<?php
$n=10;
$m=20;
echo “Number :$n and $m”;
?>

Naming Rules/Convention for Variables

• PHP variable name only start with a letter or an underscore “_”

• PHP variable name can only contain alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ )

• PHP variable name should not contain spaces. For more than one word should be separated by underscore ($w3_html), or with capitalization ($w3Html)

• PHP variable $n and $N both are different .In PHP variable name is case sensitive