Source of file array.php
Size: 0,655 Bytes - Last Modified: 2019-08-09T18:27:54+00:00
/home/travis/build/zerospam/sdk-framework/src/Utils/Helpers/array.php
12345678910111213141516171819202122232425262728293031 | <?php /** * Created by PhpStorm. * User: pbb * Date: 25/09/18 * Time: 2:51 PM */ if (!function_exists('array_map_recursive')) { /** * Maps array recursively with provided callback * * @param $callback * @param $input * * @return array */ function array_map_recursive(Closure $callback, $input): array { $output = []; foreach ($input as $key => $data) { if (is_array($data)) { $output[$key] = array_map_recursive($callback, $data); } else { $output[$key] = $callback($data); } } return $output; } } |