Split a comma-delimited string into an array?
Try explode:
$myString = "9,[email protected],8";
$myArray = explode(',', $myString);
print_r($myArray);
Output :
Array
(
[0] => 9
[1] => [email protected]
[2] => 8
)
$string = '9,[email protected],8';
$array = explode(',', $string);
For more complicated situations, you may need to use preg_split
.