Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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.
Just use json_decode.
json_decode
$dd = json_decode($mystring, true); var_export($dd);
Add a comment
you "string" is very like json so maybe try json_decode()
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);
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.