Top "Array-map" questions

PHP's array_map() function accepts Callback function to run for each element in each array and an array to run through the callback function.

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_…

php str-replace array-map
array_map on collection with array interfaces?

I have a class called Collection which stores objects of same type. Collection implements array interfaces: Iterator, ArrayAccess, SeekableIterator, and …

php arrays iterator array-map
Why won't trim work as a callback for array_walk or array_map in PHP?

Why does my sample code result in the first string still having a trailing space? $a=array('test_data_1 ',…

php trim array-map array-walk
How to convert an array of arrays or objects to an associative array?

I'm used to perl's map() function where the callback can assign both the key and the value, thus creating an …

php array-map
php array_map with static method of object

I want to use array_map with a static method but I fail. Here is my code : Class Buy { public …

php array-map
Find min/max in a two dimensional array

I have an array with the following format: Array ( [0] => Array ( [DateTime] => "2013-05-22 14:21:01" [Price] => 102.01 ) [1] => Array ( [DateTime] =&…

php arrays max min array-map
trim() function : How to avoid empty string return if the argument is unset/null variable?

I have a problem when using the trim() function in php. //Suppose the input variable is null. $input = NULL; echo (…

php trim array-map
How can i pass a single additional argument to array_map callback in PHP?

How can i pass a single additional argument to array_map callback? In my example i'd like to pass $smsPattern (…

php arrays callback closures array-map
How can I update a json object inside of an array?

I have an array of objects and I want to update some of the content. I figured I could just …

javascript json reactjs array-map
PHP array_map callback function inside function

I have a function called createCost, and inside that function, I have an array_map that takes in an array …

php arrays array-map