PHP Variables

[vc_row][vc_column][vc_column_text]

PHP Variables

Variables are use to store the value

Creating PHP Variables

In PHP, a variable starts with the $ sign, followed by the name of the variable:

Example

Live Demo

 <?php $txt = "Hello world!";
 $x = 5;
 $y = 10.5; 
 ?>

After the execution of the statements above, the variable $txt will hold the value Hello world!, the variable $x will hold the value 5, and the variable $y will hold the value 10.5.

Note: When you assign a text value to a variable, put quotes around the value.

Note: Unlike other programming languages, PHP has no command for declaring a variable. It is created the moment you first assign a value to it.

[/vc_column_text][/vc_column][/vc_row]

On: 12-24-2019