06- PHP Variables


PHP Variables

In PHP programming, variable plays a very important role wherein it allows you to store the value in a computer memory such storing some text like “PHP programming is fun” or even an integer value 8.

The declared variable can be used throughout your code without typing out the actual value over and over again.


$variable = specificvalue;

Take note!

In declaring PHP variable should begin with a dollar sign($) or else it will not work and it must start with letters and underscore only. Similar to other programming languages, PHP does not contain spaces.

PHP Variable is also a case-sensitive, so make use the proper naming convention. For example when using a variable. The variables $personand $Person are different variables in the eyes of PHP.

PHP Syntax

The code above will display the following.
PHP Programming is fun!

Same as the code above, the variables are not declared before you can use it. Take note that PHP does not require variables to be declared before being initialized.

Readers might read also:

Looking for more source code? Type your keyword here here!


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.