Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

array_map with str_replace

Is it possible to use array_map in conjunction with str_replace without calling another function to do the str_replace?

For example:
array_map(str_replace(' ', '-', XXXXX), $myArr);

like image 501
Lizard Avatar asked Jun 03 '11 11:06

Lizard


1 Answers

There is no need for array_map. From the docs: "If subject is an array, then the search and replace is performed with every entry of subject, and the return value is an array as well."

like image 200
chiborg Avatar answered Oct 05 '22 04:10

chiborg