I'm trying to use filter_var_array()
and FILTER_CALLBACK
to format some numbers, I thought this would work, but it does not:
$item_arr = filter_var_array($item_arr, array(
'item_number' => array(
'filter' => FILTER_CALLBACK,
'options' => array($this, 'number_format')
)
) );
though this does work:
$item_arr = filter_var_array($item_arr, array(
'item_number' => array(
'filter' => FILTER_CALLBACK,
'options' => function( $num ){
return number_format( $num );
}
)
) );
What's the difference between these two? What's the point of assigning an array()
to options?