How to create a variable in php ?

Explain variable declaration in php?

Your Answer

Variables are used to store data, like string of text, numbers, etc. Variable values can change over the course of a script. Here're some important things to know about variables:
In PHP, a variable does not need to be declared before adding a value to it. PHP automatically converts the variable to the correct data type, depending on its value.
After declaring a variable it can be reused throughout the code.
The assignment operator (=) used to assign value to a variable.
In PHP variable can be declared as: $var_name = value;

<?php
// Declaring variables
$txt = "Hello World!";
$number = 10;

// Displaying variables value
echo $txt; // Output: Hello World!
echo $number; // Output: 10
?>

Php

Didn't get the answer.
Contact people of Talent-Php directly by clicking here