RE: [PHP] All of a sudden I get Warning: Bad arguments to implod e() in busca_01.php on line 133
| From: | Maxim Maletsky | Date: | Tue, 22 May 2001 10:04:30 +0000 |
| Subject: | RE: [PHP] All of a sudden I get Warning: Bad arguments to implod e() in busca_01.php on line 133 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53837@lists.php.net to get a copy of this message | ||
Try:
************************************************
if (!is_array($array_id))
{
$string_id=$array_id;
}
else
{
$string_id= implode(":",$array_id);
}
************************************************
You have to always make sure, you are passing Array into an implode() or
explode().
BTW: your code would look cooler like this:
$string_id = is_array($array_id) ? implode(":",$array_id) : $array_id;
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim@phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Martin Cabrera Diaubalick [mailto:martin@notodo.com]
Sent: Tuesday, May 22, 2001 5:41 PM
To: php-general@lists.php.net
Subject: [PHP] All of a sudden I get Warning: Bad arguments to implode()
in busca_01.php on line 133
Hello Everyone!
This is my code
************************************************
if (count($array_id)==1)
{
$string_id=$array_id;
}
else
{
$string_id= implode(":",$array_id);
}
************************************************
I've been testing it for three days and never had an error, now it comes and
goes. Do you know what could be wrong?
$array_id is an array of integers
Thanks in advance
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net