note 83581 added to function.implode
| From: | Johncancelledyourbirthday at osu1 dot php dot net | Date: | Tue, 03 Jun 2008 02:47:48 +0000 |
| Subject: | note 83581 added to function.implode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140075@lists.php.net to get a copy of this message | ||
Heads up!
<?php
$data[] = "only_one_value_in_array";
$tags = implode(' OR ', $data);
echo $tags;
?>
output is
"only_one_value_in_array OR only_one_value_in_array"
If you do a join on an array that only has one value the implode function will use it twice instead
of just skipping it. Why does PHP fight us every step of the way?
----
Server IP: 208.69.120.35
Probable Submitter: 128.171.188.10
----
Manual Page -- http://www.php.net/manual/en/function.implode.php
Edit -- https://master.php.net/note/edit/83581
Del: integrated -- https://master.php.net/note/delete/83581/integrated
Del: useless -- https://master.php.net/note/delete/83581/useless
Del: bad code -- https://master.php.net/note/delete/83581/bad+code
Del: spam -- https://master.php.net/note/delete/83581/spam
Del: non-english -- https://master.php.net/note/delete/83581/non-english
Del: in docs -- https://master.php.net/note/delete/83581/in+docs
Del: other reasons-- https://master.php.net/note/delete/83581
Reject -- https://master.php.net/note/reject/83581
Search -- https://master.php.net/manage/user-notes.php