PHP Variables
- PHP variables provide a way to temporarily store data used in a script. Passing PHP variables between functions is a cornerstone of PHP programming; fully understanding their rules and usage in PHP is paramount.
- PHP variable is a temporary memory allocation which used to store data.
- In PHP, variable is declared by "$" sign, we do'nt require to declare data type
In c programming Language In php int a = 34;
float a = 45.67;
char a = 'aligarh';$a = 34;
$a = 45.67;
$a = 'aligarh'; - Half of these are scalar types, meaning they hold only a single value. These are: Booleans (True/False), integers, floating-point numbers, and strings (any quoted character or sequence of characters).
- PHP supports two non-scalar types:
1- arrays
2-objects. - Finally, PHP supports two special types:
1 - resources - Resource types provide a pointer-like reference to database connections, opened files and directories, dynamically-generated images, etc.
2 - NULL -The NULL type is represented by : the constant NULLNaming Conventions
Variables in PHP must abide by certain naming conventions. Specifically, they - Variable name start with the dollar sign
- Variable name must contain only letters, numbers, and the underscore
- Variable cannot start with a number
- Variable name are case sensitive
- We can user space in between character of varaible name
- Resourses
- NULL
- Resource types provide a pointer-like reference to database connections, opened files and directories, dynamically-generated images, etc.
- The NULL type is represented by:
the constant NULL
-a variable not assigned a value
-a variable that has been unset
No comments:
Post a Comment