In PHP, a variable is declared using a $ sign followed by the variable name.
=) is used to assign the value to a variable.Syntax of PHP Variables :
$variablename=value;
$) sign followed by the variable name.$var name_) character.The below example show to store string, integer, and float values in PHP variables.
Example :
<?php
$str="hello world tring";
$x=150;
$y=42.5;
echo "string is: $str <br/>";
echo "integer is: $x <br/>";
echo "float is: $y <br/>";
?>
OUTPUT
string is: hello world tring
integer is: 150
float is: 42.5
PHP is a loosely typed language, it means PHP automatically converts the variable to its correct data type.