Warum beschwert sich PHP nicht, wenn ich einen Nullwert wie folgt als Array behandle?
In PHP habe icherror_reporting
setze alles inklusive hinweise zu melden.
Warum wirft das Folgende keine Notizen, Fehler oder irgendetwas anderes?
$myarray = null;
$myvalue = $myarray['banana'];
Schritte zur Fehlerbehebung:
$myarray = array();
$myvalue = $myarray['banana'];
// throws a notice, as expected ✔
$myarray = (array)null;
$myvalue = $myarray['banana'];
// throws a notice, as expected ✔
$myarray = null;
$myvalue = $myarray['banana'];
// no notice or warning thrown, $myvalue is now NULL. ✘ Why?
Es ist möglich, dass es ein Fehler in PHP ist, oder ich verstehe einfach nicht, wie das funktioniert.