Re: Re:[VOTE] array_key_first(), array_key_last(), array_value_first(),array_value_last()

From: Date: Wed, 11 Jul 2018 15:32:13 +0000
Subject: Re: Re:[VOTE] array_key_first(), array_key_last(), array_value_first(),array_value_last()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-102760@lists.php.net to get a copy of this message
Le mercredi 11 juillet 2018, 07:37:56 CEST Levi Morrison a écrit : > This is true. For completeness the fix is very mild: > > if (([$_, $value] = array_first(some_function()) && $value > 3) { > // do something > } > > I still think this is better. Forcing you to handle the error case is > not a bad thing. The point of these functions is to avoid complicated hard to read code for simple operations. This if is hard to read for me and not much better that array_values(some_function())[0]. Côme

« previous php.internals (#102760) next »