3v4l.org

run code in 300+ PHP versions simultaneously
<?php $config = [ "type" => '{"category":"admin","page":"page"}', "say" => "Hello", "php" => [ "say" => "no", "type" => '{"category":"admin","page":"page"}', "gran" => [ "name" => "Hi", "foo" => '7', "bar" => null, ], ], ]; function decode_json_only(array|object &$data, bool $toArray = true) { foreach ($data as &$v) { if (is_string($v) && json_validate($v)) { $v = json_decode($v, $toArray); } if (is_array($v) || is_object($v)) { $v = (__FUNCTION__)($v, $toArray); } } return $data; } var_export(decode_json_only($config));
Output for git.master_jit, git.master, rfc.property-hooks
array ( 'type' => array ( 'category' => 'admin', 'page' => 'page', ), 'say' => 'Hello', 'php' => array ( 'say' => 'no', 'type' => array ( 'category' => 'admin', 'page' => 'page', ), 'gran' => array ( 'name' => 'Hi', 'foo' => 7, 'bar' => NULL, ), ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
80 ms | 406 KiB | 5 Q