Shows how to use the array_map function.
function filter_val($val){
$val = str_replace('.', '', $val);
return $val;
}
$a = array(
'one' => 'two.',
'three' => 'four.',
'five' => 'six.'
);
$array = array_map('filter_val', $a);
print_r($array);
/*
returns:
Array
(
[one] => two
[three] => four
[five] => six
)
*/
function filter_val($val){
$val = str_replace('.', '', $val);
return $val;
}
$a = array(
'one' => 'two.',
'three' => 'four.',
'five' => 'six.'
);
$array = array_map('filter_val', $a);
print_r($array);
/*
returns:
Array
(
[one] => two
[three] => four
[five] => six
)
*/
0 comments:
Post a Comment