3v4l.org

run code in 300+ PHP versions simultaneously
<?php function map_deep( $value, $callback ) { if ( is_array( $value ) ) { foreach ( $value as $index => $item ) { $value[ $index ] = map_deep( $item, $callback ); } } elseif ( is_object( $value ) ) { $object_vars = get_object_vars( $value ); foreach ( $object_vars as $property_name => $property_value ) { $value->$property_name = map_deep( $property_value, $callback ); } } else { $value = call_user_func( $callback, $value ); } return $value; } var_dump(map_deep(new ArrayObject([1,2,3]), 'md5'));

preferences:
83.86 ms | 405 KiB | 5 Q