-1

I've a string like this:

$mystring = '{"1":"4","2":"2","3":"3"}';

I need to explode to something like this:

array(
  "1" => "4",
  "2" => "2",
  "3" => "3"
)

I use php 5.4.

0

3 Answers 3

1

Just use json_decode.

$dd = json_decode($mystring, true);
var_export($dd);
Sign up to request clarification or add additional context in comments.

Comments

1

you "string" is very like json so maybe try json_decode()

Comments

0

you should use the json decode function, your string looks like json. The second argument tells to make it as an array, not an object.

json_decode($mystring, true);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.