3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = <<< FILE users["524bd089-2a7b-4a71-ba23-16354d6351ae"] = { "id" : "524bd089-2a7b-4a71-ba23-16354d6351ae", "firstName" : "A", "lastName" : "T", "pictureName" : "66s2c.jpg", "username" : "a", "libraries" : [ "lEy27AZavfSR", "l0yApAoo2l4b", "lJl22YOtacxY", "l0UhMCvrMmka", "lJMWpIoFnaK4", "lCZ9cYYjVJcv", "l8kynpyoaej7" ] } libraries["lEy27AZavfSR"] = { "id" : "lEy27AZavfSR", "name" : "My Main Library", "description" : null, "numKeeps" : 0, "keeps" : [ ] } keeps["k4r5UIugqgfk"] = { "id" : "k4r5UIugqgfk", "keptAt" : 1449613295000, "lastActivityAt" : 1449613295000, "title" : "", "url" : "", "note" : null, "tags" : [ ], "libraries" : [ "lJl22YOtacxY" ], "summary" : "", "messages" : [ ] } FILE; preg_match_all("/(\w+)\[\"([^\]]*)\"\]\s*\=\s\{([^\}]*)\}*/", $file, $matches); foreach ($matches[1] as $key => $value) { $data[$value][$matches[2][$key]] = json_decode('{'.$matches[3][$key].'}'); } print_r($data);
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Array ( [users] => Array ( [524bd089-2a7b-4a71-ba23-16354d6351ae] => stdClass Object ( [id] => 524bd089-2a7b-4a71-ba23-16354d6351ae [firstName] => A [lastName] => T [pictureName] => 66s2c.jpg [username] => a [libraries] => Array ( [0] => lEy27AZavfSR [1] => l0yApAoo2l4b [2] => lJl22YOtacxY [3] => l0UhMCvrMmka [4] => lJMWpIoFnaK4 [5] => lCZ9cYYjVJcv [6] => l8kynpyoaej7 ) ) ) [libraries] => Array ( [lEy27AZavfSR] => stdClass Object ( [id] => lEy27AZavfSR [name] => My Main Library [description] => [numKeeps] => 0 [keeps] => Array ( ) ) ) [keeps] => Array ( [k4r5UIugqgfk] => stdClass Object ( [id] => k4r5UIugqgfk [keptAt] => 1449613295000 [lastActivityAt] => 1449613295000 [title] => [url] => [note] => [tags] => Array ( ) [libraries] => Array ( [0] => lJl22YOtacxY ) [summary] => [messages] => Array ( ) ) ) )
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6
Fatal error: Call to undefined function json_decode() in /in/fW5gH on line 37
Process exited with code 255.
Output for 5.1.2
Fatal error: Call to undefined function json_decode() in /in/fW5gH on line 38
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_decode() in /in/fW5gH on line 37
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.4
Fatal error: Call to undefined function: json_decode() in /in/fW5gH on line 37
Process exited with code 255.
Output for 4.4.2
Fatal error: Call to undefined function: json_decode() in /in/fW5gH on line 38
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_decode() in /in/fW5gH on line 37

preferences:
388.22 ms | 401 KiB | 465 Q