How'd you end up with a string like that?
If you have a newer version of PHP and the data comes from a completely trusted source, you can use eval:
PHP Code:
$replace = "['data1','Hi there'],['data2','Hello there']";
eval("\$a = [$replace];");
print_r($a);
Otherwise you can explode it and then explode each item:
PHP Code:
$aParts = explode('],[', trim($replace, ']['));
foreach ($aParts AS &$part)
{
$part = explode("','", trim($part, "'"));
}
print_r($aParts);
Both of which should result in:
Code:
Array
(
[0] => Array
(
[0] => data1
[1] => Hi there
)
[1] => Array
(
[0] => data2
[1] => Hello there
)
)