Re: Revisiting RFC: Engine Warnings -- Undefined array index
| From: | Andreas Leathley | Date: | Tue, 13 Dec 2022 10:16:33 +0000 |
| Subject: | Re: Revisiting RFC: Engine Warnings -- Undefined array index | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119115@lists.php.net to get a copy of this message | ||
On 13.12.22 11:01, Robert Landers wrote:
intended: ($a['foo'] ?? null) || ($a['bar'] ?? null) Further, writing code like this increases the number of opcodes needed to perform relatively simple logic by ~150%, increasing end-user latency and spending CPU cycles somewhat needlessly. I think it is quite the opposite: calling the error handler because ofE_NOTICE (or now E_WARNING) is quite the additional overhead, and if projects just ignore E_NOTICE their applications will be slowed down because of that, while fixing the code will avoid the error handler altogether. Just because something is longer to write in a programming language also does not make it necessarily slower. But if you have any actual measurements why using the null coalescing operator would slow down code in general that would be something useful to share.