Monday, March 20, 2017

php convert $str = '[0=>"hello",1=>"world"]'; into indexed array

I a string stored on my database in the following format:

$str = '[0=>"hello",1=>"world"]';

I wish to convert this into an array which would have the 0,"hello" key-value pair, 1,"world" key-value pair.

If there is a better way to format and store the string to make the conversion to array easier I would be open to that answer.

Thanks for your help Jordan



via user3502651

Advertisement