note 40527 added to function.implode
| From: | php-general at lists dot php dot net | Date: | Sat, 06 Mar 2004 18:59:49 +0000 |
| Subject: | note 40527 added to function.implode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66351@lists.php.net to get a copy of this message | ||
why so long?
<?php
/*
* Returns a string with imploded array-elements like ?key1=value1&key2=value2
* if array is empty or no array, it will return an empty string
*/
function httpimplode($aryInput, $quma = 1)
{
if (!is_array($aryInput) or count($aryInput)=0) return ''; //comment this line and
strings, ints, etc are returned as "0=$aryInput"
foreach ( (array)$aryInput as $key => $value ) $aryOutput[] = urlencode($key) . '=' .
urlencode($value);
return (($quma)?('?'):('')) . implode('&', $aryOutput);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.implode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40527
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40527&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40527&report=yes
Search -- http://master.php.net/manage/user-notes.php