private static function returnSameElementIfNotEmpty($item) { if (empty($item)) { return false; } else{ return true; } } public static function clean($array) { return array_filter($array, 'returnSameElementIfNotEmpty'); }
When I try to run this using the sample array, I get:
Warning: array_filter () expects parameter 2 to be a valid callback, function 'returnSameElementIfNotEmpty' not found or function name in C: \ Framework \ ArrayMethods.php on line 27 is not valid
source share