How to use PHP variable
In this article I am going to explain PHP variable.
Use PHP Variable
PHP variables are used to hold values or expressions.
A variable can have short name in PHP, like a.
Rules for PHP variable names:
PHP variable is start $ sign.
PHP variable name must begin with a letter or the underscore.
PHP variable name should not have spaces.
This is a case sensitive (a and A are different variable).
Creating PHP Variables
PHP has no command for declaring a variable.
The variable myBike will hold the value Volvo.
Let's create a variable containing a string, and a variable containing a number:
PHP is a Loosely Typed Language
A variable does not need to be declared before adding a value in PHP.
PHP automatically converts the variable to the correct data type.
In a strongly typed programming language, we have to declare the type and name of the variable before using it.
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here