note 71677 deleted from function.http-build-query by hholzgra

From: Date: Thu, 02 Aug 2012 13:36:42 +0000
Subject: note 71677 deleted from function.http-build-query by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189772@lists.php.net to get a copy of this message
Note Submitter: flyingmeteor at gmail dot com ---- Here is another equivalent function for users that don't have PHP5 yet, it behaves the same way as the PHP5 counterpart and has one extra parameter for added functionality. <?php if (!function_exists('http_build_query')) { function http_build_query($data, $prefix='', $sep='', $key='') { $ret = array(); foreach ((array)$data as $k => $v) { if (is_int($k) && $prefix != null) $k = urlencode($prefix . $k); if (!empty($key)) $k = $key.'['.urlencode($k).']'; if (is_array($v) || is_object($v)) array_push($ret, http_build_query($v, '', $sep, $k)); else array_push($ret, $k.'='.urlencode($v)); } if (empty($sep)) $sep = ini_get('arg_separator.output'); return implode($sep, $ret); }} ?>

« previous php.notes (#189772) next »