<?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']) ) { echo "Substituting\n"; $subv = '@ ' . $metadata['uri']; } } } } } } $a = ['multipart' => [['name' => 'foo', 'contents' => fopen('/tmp/aaaaaa', 'w')]]]; stringifyRequestParamsRecursive($a); echo json_encode($a, JSON_PRETTY_PRINT);
You have javascript disabled. You will not be able to edit any code.