Array map

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 ) */

Url: http://www.jonasjohn.de/snippets/php/array-map.htm

Language: PHP | User: ShareMySnippets | Created: Oct 16, 2013