<?php // your code goes here$arr = array('foo' => 'bar', 2 => 'test');$json = json_encode($arr);var_dump($json);$arr = json_decode($json, true);var_dump($arr);foreach ($arr as $k => $v) { echo "$k => $v\n";}
Standard input is empty
string(24) "{"foo":"bar","2":"test"}" array(2) { ["foo"]=> string(3) "bar" [2]=> string(4) "test" } foo => bar 2 => test
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!