> Why? If "assume $key2 exists as a key and is an integer" is so bad that PHP > should halt my program, why should "assume $key1 exists and is an array" > be perfectly OK?
Warning is triggered by reading non-existing key, not assigning value to it. In `$foo[$key1][$key2] ??= 0` you never try to read non-existing key. > Please can you show me a bug that adding this line has avoided? I don't doubt > that the same warning saves bugs in other scenarios, but in this > scenario, the logic is unambiguous, and any additions are just to suppress > unnecessary errors. Well, then let's say that it is "lesser evil" - one additional line is better than ignoring reading uninitialized values. And IMO it is not a "problem" that would justify introducing special syntax for saving one line in such niche case. Regards, Robert Korulczyk -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php