PHP Variables
PHP Variables
Variables syntax
<html> <body> <?php $var = "variable"; echo $var; ?> </body> </html>
Variables example
<html> <body> <?php $name1 = "PHP course"; $name2 = "MySQL course"; $a = 20; $b = 30; $c = $a + $b; echo "Select {$name1} .<br />"; echo "Select " . $name2 . "<br />"; echo "The price for ", $name1, " is ", $c; ?> </body> </html>
Result
Select PHP course .
Select MySQL course
The price for PHP course is 50