Page 1 of 1

listToArray()

Posted: Tue Jul 09, 2002 2:04 pm
by justgetaway
I would like to convert a comma separated list to an array.

$myList = "value1, value2, value3, ...";

$myArray = listToArray($myList);

I don't see a native function for this, but being inexperienced with PHP, I may have missed it. I could build it with regular expressions, but thought this must be a pretty common function, so I thought I would check here first.

Greg Alton

Posted: Tue Jul 09, 2002 2:07 pm
by RandomEngy

Code: Select all

$myArray = explode(", ", $myList);

Posted: Tue Jul 09, 2002 2:15 pm
by justgetaway
Thanks for saving me time and redundancy!

Greg Alton