3v4l.org

run code in 500+ PHP versions simultaneously
<?php function stringifyRequestParamsRecursive(&$array) { foreach ($array as $k => &$v) { if ($k == 'multipart' && is_array($v)) { foreach ($v as $subk => &$subv) { if ( is_array($subv) && !empty($subv['name']) && !empty($subv['contents']) && is_resource($subv['contents']) ) { if ( get_resource_type($subv['contents']) === 'stream' && $metadata = stream_get_meta_data($subv['contents']) && !empty($metadata['uri']) ) { $subv = '@ ' . $metadata['uri']; } } } } } } $a = ['multipart' => [['name' => 'foo', 'value' => 'bar']]]; stringifyRequestParamsRecursive($a); echo json_encode($a, JSON_PRETTY_PRINT);

preferences:
60.64 ms | 2773 KiB | 5 Q