submitted by:
PHP: Create array from comma separated list
Use the PHP Explode() command to create an array from a comma separated list. By changing the delimiter you can convert tab separated, newline separated, etc..
code snippet:
<?php
//create an array from a comma separated list
$list = "green, purple, blue, yellow, amber, red";
$array = explode(',', $list);
print_r($array);
?>
sample output:
Array ( [0] => green [1] => purple [2] => blue [3] => yellow [4] => amber [5] => red )



