I have the following code snippet:
error_reporting(E_ALL | E_STRICT); function &getVal() { $data = []; return $data['hey']; //return $whatever; } function getVal2() { $data = []; return $data['hey']; } var_dump(getVal()); // No E_NOTICE error is issued - why? var_dump(getVal2()); // E_NOTICE error is issued.
And the question is: why is there no E_NOTICE error in the first call? The explanation is most likely that the variable $data['hey'] created to return the link. However, it still seems wrong to not throw an E_NOTICE error if $data['hey'] (or $whatever , ... ) is not defined.
php
Martin vseticka
source share