Thursday , February 21 2019
Home / Web Technologies / PHP / Lesson 3: PHP Variables

Lesson 3: PHP Variables

PHP Variables, Variables are one of the most important aspects of every programming language. They allow you to store a value within a named container, for later use or manipulation. Storing and retrieving something from memory is a complicated task, but fortunately, PHP hides all this low level stuff, and makes it super easy to declare and use variables.

PHP Variables:

In PHP, a variable is declared using $ sign followed by variable name.Syntax for declaring a variable in PHP is given below :


Some of Examples of PHP Variables :

After the execution of the statements above, the variable $txt will hold the value Study Clues, the variable $x will hold the value PHP, and the variable $y will hold the value 5.

Note :PHP variable names are case-sensitive.
Note :When you assign a text value to a variable, put quotes around the value.
Note :A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).

Print Friendly, PDF & Email

Give us your valuable feedback


About Kadiyala

Check Also

Lesson 1 : Introduction to PHP

Introduction to PHP : PHP is introduced by RASMUS LERDORF in 1994. It is an …