note 77375 deleted from function.http-build-query by nlopess
| From: | nlopess@php.net | Date: | Sat, 01 Sep 2007 12:16:49 +0000 |
| Subject: | note 77375 deleted from function.http-build-query by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130029@lists.php.net to get a copy of this message | ||
Note Submitter: valdikss at gmail dot com
----
This function is wrong for http!
arrays in http is like this:
files[]=1&files[]=2&...
but function makes like this
files[0]=1&files[1]=2&...
Here is normal function:
<?php
function cr_post($a,$b=\\\'\\\',$c=0){
if (!is_array($a)) return false;
foreach ((array)$a as $k=>$v){
if ($c) $k=$b.\\\"[]\\\"; elseif (is_int($k)) $k=$b.$k;
if (is_array($v)||is_object($v)) {$r[]=cr_post($v,$k,1);continue;}
$r[]=urlencode($k).\\\"=\\\".urlencode($v);}return implode(\\\"&\\\",$r);}
?>