Hi to all.
I have a question:
How can I put this string "(1,2,3)" in an array like this (0 => 1, 1 => 2, 2 => 3)?
I tried this: $array=(); $string="(1,2,3)"; ereg_replace (",", ", ", $string); $array[]=$string;
It doesn't work. Any help?
Thanx _
Try this (untested):
$string = "(1,2,3)"; preg_match("((.*))", $string, $matches); $array = explode(',', $matches[1]);
Diego
$string = "(1,2,3)";
$string = trim($string,'()'); $string_array = explode(',',$string);
that should do it.