mapDeep() public static method

Returns an array containing all the elements of arr1 after applying the callback function to each one.
public static mapDeep ( array $array, string $callback, boolean $onNoScalar = false ) : array
$array array An array to run through the callback function
$callback string Callback function to run for each element in each array
$onNoScalar boolean Whether or not to call the callback function on nonscalar values (Objects, resources, etc)
return array
示例#1
0
文件: ArrayTest.php 项目: jbzoo/utils
 public function testMapDeep()
 {
     $input = array('<', 'abc', '>', 'def', array('&', 'test', '123'), (object) array('hey', '<>'));
     $expect = array('&lt;', 'abc', '&gt;', 'def', array('&amp;', 'test', '123'), (object) array('hey', '<>'));
     is($expect, Arr::mapDeep($input, 'htmlentities'));
 }