While writing a recent application I accidentally started filling an array before I had declared it.
error_reporting ( E_ALL);
$array['value'] = 'Test string';
I use E_ALL error reporting and an error was not thrown. Is this correct? And if so, are there any issues with declaring array values whilst never declaring the actual array?
Perhaps it just doesn’t follow good programming standards.
PHP is a weakly typed language. Your statement:
is an implicit declaration (through assignment) of an associative array. So, a notice will not be generated.
However, if you were to write:
before an assigment, then you’ll receive an
Undefined variablenotice.