I'm trying to delete empty elements in an array with the function array_filter.
When i use an external callback like this :
function callback($a) { return !empty($a);}
$arr = array("abc",'','ghi');
$res = array_filter($arr, "callback");
it works as expected.
But if i use array_filter like that :
$arr = array("abc",'','ghi');
$res = array_filter($arr, function($a) { return !empty($a);});
It fails with the error :
PHP Parse error: syntax error, unexpected T_FUNCTION in test.php on line 2
What am i doing wrong ?