note 51276 added to function.implode
| From: | php-general at lists dot php dot net | Date: | Fri, 25 Mar 2005 13:48:52 +0000 |
| Subject: | note 51276 added to function.implode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86972@lists.php.net to get a copy of this message | ||
Here's another complicated way to do some more advanced imploding:
<?php
$tables[] = array('table1', 'alias1');
$tables[] = array('table2', 'alias2');
$tables[] = array('table3', 'alias3');
$tables[] = array('table4', 'alias4');
echo implode(', ', array_map('implode', $tables, array_fill(0, count($tables),
' AS ')));
// prints: table1 AS alias1, table2 AS alias2, table3 AS alias3, table4 AS alias4
echo '<br />';
$vars[] = array('var1', 'value1');
$vars[] = array('var2', 'value2');
$vars[] = array('var3', 'value3');
$vars[] = array('var4', 'value4');
echo implode('&', array_map('implode', $vars, array_fill(0, count($vars),
'=')));
// prints: var1=value1&var2=value2&var3=value3&var4=value4
?>
But this still isn't really what we want isn't it?... ;)
----
Manual Page -- http://www.php.net/manual/en/function.implode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51276
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51276&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51276&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51276&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51276&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51276&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51276&report=yes
Search -- http://master.php.net/manage/user-notes.php