note 103861 added to function.implode
| From: | tl at magus dot dk | Date: | Sat, 07 May 2011 05:42:06 +0000 |
| Subject: | note 103861 added to function.implode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179518@lists.php.net to get a copy of this message | ||
It is also possible to implode an associative array using the following code (if you do not like
(mis-)using http functions):
<?php
$assoc_array = array("Key1" => "Value1", "Key2" =>
"Value2");
$new_array = array_map(create_function('$key, $value', 'return
$key.":".$value." # ";'), array_keys($assoc_array),
array_values($assoc_array));
print implode($new_array);
?>
Which will output:
Key1:Value1 # Key2:Value2 #
----
Server IP: 69.147.83.197
Probable Submitter: 147.29.56.7
----
Manual Page -- http://www.php.net/manual/en/function.implode.php
Edit -- https://master.php.net/note/edit/103861
Del: integrated -- https://master.php.net/note/delete/103861/integrated
Del: useless -- https://master.php.net/note/delete/103861/useless
Del: bad code -- https://master.php.net/note/delete/103861/bad+code
Del: spam -- https://master.php.net/note/delete/103861/spam
Del: non-english -- https://master.php.net/note/delete/103861/non-english
Del: in docs -- https://master.php.net/note/delete/103861/in+docs
Del: other reasons-- https://master.php.net/note/delete/103861
Reject -- https://master.php.net/note/reject/103861
Search -- https://master.php.net/manage/user-notes.php