Re: Array to List
| From: | Curt Zirzow | Date: | Mon, 11 Aug 2003 19:18:04 +0000 |
| Subject: | Re: Array to List | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159179@lists.php.net to get a copy of this message | ||
* Thus wrote James Johnson (james@smb-studios.com):
> Hello,
>
> Coming from ColdFusion, this is difficult. CF has an ArrayToList() function.
> I can't find anything similar in PHP.
>
> I'm building a list from an array with the following code, but it puts a
> trailing "," and I need to remove it.
>
> $campusList = "";
> foreach ($_POST['campus'] as $campus_ID){
> $campusList .= $campus_ID;
> $campusList .= ",";
> }
Just need to truncate the last character:
$campusList = substr($campusList,0, -1);
> print($campusList);
Curt
--
"I used to think I was indecisive, but now I'm not so sure."