@Fabio Because in the first case you have a variable amount of input array parameters but only one callback parameter, and in the second case you have only one input array parameter but two optional parameters 🙃
@Fabio No, it returns a new array with all the non-empty values in the input array. It doesn't empty the array, unless there are no non-empty values in it.
@Fabio Definitely something that's too clever for its own good. You can definitely see the Perl inspiration at work here: "How about we shorten the syntax so that it's extremely counter-intuitive but pretty nifty once you figure it out".
Questo sito utilizza cookie per riconosce gli utenti loggati e quelli che tornano a visitare. Proseguendo la navigazione su questo sito, accetti l'utilizzo di questi cookie.
Hypolite Petovan
in reply to Fabio • • •Fabio
in reply to Hypolite Petovan • •Hypolite Petovan likes this.
Fabio
in reply to Fabio • •Hypolite Petovan likes this.
Hypolite Petovan
in reply to Fabio • • •@Fabio
It is pretty handy tho.
Fabio
in reply to Hypolite Petovan • •I'm sure. Still I don't like it.
Hypolite Petovan likes this.
Fabio
in reply to Fabio • •@Hypolite Petovan
array_filter()
gets the array by value, so no entries are "removed". you always get a new array.so why not just
$empty_array = [];
?Hypolite Petovan
in reply to Fabio • • •Fabio
in reply to Hypolite Petovan • •Hypolite Petovan
in reply to Fabio • • •