Warning: array_filter() expects parameter 2 to be a valid callback, function \'empty\' not found or invalid function name....
Why is e
I think a better solution exist and I found it reading the doc about array_filter
See this comment : https://www.php.net/manual/fr/function.array-filter.php#111091
I only allow myself to post it because I think it's a very elegant solution.
Also, as array_filter itself already filter null or false value as a default callback, this code work too :
$array = array('apple', '', 'watermelon');
var_dump(array_filter($array));
----
Output :
array(2) { [0]=> string(5) "apple" [2]=> string(10) "watermelon" }