Replacement for PHP < 5 added, credits and thanks to Marco K. (Germany)
authorRoland Häder <roland@mxchange.org>
Fri, 30 Oct 2009 06:44:13 +0000 (06:44 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 30 Oct 2009 06:44:13 +0000 (06:44 +0000)
inc/functions.php

index 6bf29c4..2d4fcf4 100644 (file)
@@ -3576,5 +3576,29 @@ if (!function_exists('html_entity_decode')) {
        }
 } // END - if
 
+if (!function_exists('http_build_query')) {
+       // Taken from documentation on www.php.net, credits to Marco K. (Germany)
+       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);
+                       } // END - if
+
+                       if ((!empty($key)) || ($key === 0))  $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));
+                       }
+               } // END - foreach
+
+               if (empty($sep)) $sep = ini_get('arg_separator.output');
+
+               return implode($sep, $ret);
+       }
+}// // END - if
+
 // [EOF]
 ?>