3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{"description 1": { "year0": "49", "year1": "48", "year2": "876786", "year3": "1234" } }'; $a = json_decode($json, true); $r = []; foreach($a['description 1'] as $k => $v){ $index = (int) filter_var($k, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $r[$k] = ($index == 0) ? '' : $a['description 1']['year'.--$index]; } print_r($r);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [year0] => [year1] => 49 [year2] => 48 [year3] => 876786 )

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:
27.48 ms | 405 KiB | 5 Q