saftutorials.com
PHP Variable Tutorial

In the middle of PHP programs, we can store temporary data through PHP variables. There is no need to declared a variable before assigning the value. PHP variable starts from the $ sign.


How to declare PHP Variable?

PHP Variable declare usign dollar sign ($)

How to use PHP Variable?

First declare a PHP variable then it call any place of page or another page where declare page already included.


PHP Variable Example

<!DOCTYPE html>
<html>
<body>
<?php
$php_string = "This is a string";
$php_integer = 357;
$php_float = 5.201;

?>
<p>This is a PHP string variable example : <?php echo $php_string; ?></p></br>
<p>This is a PHP integer variable example : <?php echo $php_integer; ?></p></br>
<p>This is a PHP float variable example : <?php echo $php_float; ?></p>
</body>
</html>


The above code produces the following results

Outputs: This is a PHP string variable example: This is a string

This is a PHP integer variable example: 357

This is a PHP float variable example: 5.201

Find us on

Facebook Google Plus Twitter Pinterest YouTube

web statistic