If you have PHP 5.3+, then there is no need to use a string as the callback parameter. PHP 5.3+ has anonymous functions.
$matches = array_filter($my_array, function($row) use($num){
return filter($row, $num);
});
If you do not have PHP 5.3, then you can use create_function
(warning: this uses eval()
):
$matches = array_filter($my_array, create_function('$row', 'return filter($row,'.$num.');'));