PROGRAMMING

 
REMEMBERS




Last update:   29-10-2021

Loosely typed

PHP will implicitly change the type of a variable as needed. This contrasts with strongly typed languages, like C and Java. Where variables can only contain one type of data throughout their existence.

Naming

Variables must be named using only letters, numbers and underscore. Variables must start with a letter or an underscore.
 
$name = 'valid'; // Valid name
$_name = 'valid'; // Valid name
$1name = 'invalid'; // Invalid name, starts with a number

Case sensitive

Variables are one of only two identifier types in PHP that are case-sensitive. The other are constants.
 
error_reporting(E_ALL);

$Name = "John";
echo $name; // Notice: Undefined variable: name

Questions    
Variable variables

        A B C D E F
🔔
1/3