3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = json_encode(array('sleep' => 123)); $b = json_encode(array('sleep' => 987)); $logs = array(array('date' => '2014-01-01', 'data' => $a), array('date' => '2015-01-01', 'data' => $b)); $result = array_reduce($logs, function ($cur, $x) { $data = json_decode($x['data']); $cur[$x['date']] = $data->{'sleep'}; return $cur; }, array()); var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["2014-01-01"]=> int(123) ["2015-01-01"]=> int(987) }

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:
38.95 ms | 401 KiB | 8 Q