$var = "['test', 'test2', 'test3']";
how do I create a workable array from this in PHP?
I've tried explode($var, ","); but this didn't seem to work, unless something went wrong with that attempt.
$var = "['test', 'test2', 'test3']";
how do I create a workable array from this in PHP?
I've tried explode($var, ","); but this didn't seem to work, unless something went wrong with that attempt.
explode($var, ","); is wrong. explode needs the first argument to be the delimiter and the second be the string. Replace [] and then explode -
$var = "['test', 'test2', 'test3']";
$var = str_replace(array('[', ']'), '', $var);
$arr = explode(',', $var);