php - List of objects -
what best method find parent items of comma separated string?
e.g.
array(1,2,3),array("test","123, abc"),1,"abc, 123"
to get
array(1,2,3) array("test","123, abc") 1 "abc, 123"
is possible regular expression, or there nifty php function this?
use explode
.
$myarray = explode(",",$original);
this assuming original string, , desired output can iterate through:
$original = 'array(1,2,3),array("test","123, abc"),1,"abc, 123"'; $myarray = explode(",",$original); foreach ($myarray $item) { echo $item."\n"; }
Comments
Post a Comment