Hello, welcome to zhullyblog. If this is your first time here , please
Subscribe to Zhullyblog by Email to get latest tutorial.
PHP variables
A variable is a container used to store data like text , numbers and values. In PHP , a variable starts with a dollar($) sign followed by the variable name. An assignment operator (=) is the operator used to assign a value to a variable.
Variable Syntax
$variable name = value
Let’s take an example.
<?php
// how to declare a variable in PHP
$txt = "Hello World!";
$number = 10;
?>
Fro the example above, the $ sign starts and then the variable name is txt and an assignment operator (=) was used and the value Hello world was assigned to it.
That is how it works.
Example 2
<?php
//Add two numbers
$num= 20;
$numm=30;
$val = $num + $numm;
?>
Output :
50
Please share
OTHER TUTORIALS
Comments
Post a Comment