PHP string presented as array to array -


$var = "['test', 'test2', 'test3']"; 

how create workable array in php?

i've tried explode($var, ","); didn't seem work, unless went wrong attempt.

explode($var, ","); wrong. explode needs first argument delimiter , second string. replace [] , explode -

$var = "['test', 'test2', 'test3']";  $var = str_replace(array('[', ']'), '', $var); $arr = explode(',', $var); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -