I've never used the array_filter function before so giving it a go by no matter what I use as the function name it is giving me the error
Warning: array_filter() expects parameter 2 to be a valid callback, function 'odd' not found or invalid function name in
I have even taken the steps of copying paste the example directly off the php manual page and it is giving me that same error. Code:
function odd($var) {
// returns whether the input integer is odd
return($var & 1);
}
function calculate($res, $period, $elements, $per, $total, $brand = false) {
$array1 = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5);
$array2 = array(6, 7, 8, 9, 10, 11, 12);
echo "Odd :\n";
print_r(array_filter($array1, "odd"));
}
I really don't know where to go here. Usually when I'm having trouble I can copy and paste the code exact off the php manual page and work my way back from there but if their example isn't even working it makes it hard.
4.3.0 - 5.4.9