In your code, try dumping the cotents of the array before you use array_filter().
EG:
var_dump($fee2_code);
$fee2_code = array_filter($fee2_code); //line 155
The error is because it isn't an array. Even though your HTML looks ok and it seem it should be an array.
It is difficult to understand what the callback is can you explain better than the PHP manual?
Note: I was looking at Example 2. array_filter() without callback.
The callback is a function that you define, that will be executed in another function.
If you were to implement callback functions in your own code, it could look something like:
/**
* Example of function using a callback. (same as array_filter except it will filter out empty strings also)
* @param array The array to filter
* @param function The callback function
*/
function my_array_filter($array, $callback = false) {
if (!$callback) {
$callback = 'trim'; // default callback function: trim()
}
$new_array = array(); // filtered array
foreach($array as $index=>$value) {
// execute the callback function passing it the argument: $value
if (call_user_func($callback, $value)) {
$new_array[$index] = $value;
}
}
return $new_array;
}
/**
* Example of my_array_filter()
*/
$arr = array('hey', false, true, '0', ' ', '');
var_dump(my_array_filter($arr));
echo '<br />';
var_dump(array_filter($arr));
If you look at the function, my_array_filter, there is a line:
call_user_func($callback, $value)
call_user_function will execute a user defined function. Since this function name is passed as an argument in to a function, then it is called a callback.
It …