3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ['2018-05'=> '15', '2018-06'=> '100']; $b = ['2018-05'=> '5']; $years = array_map(NULL, $a, $b); $years = array_combine(array_keys($a), $years); $differences = array_map(function ($year_diffs) : float { // Did we get a pair to compare? $has_diff = isset($year_diffs[0]) and isset($year_diffs[1]); // If we got a pair then compare, else assume we got one. $diff = $has_diff ? abs($year_diffs[0] - $year_diffs[1]) : $year_diffs[0]; return $diff; }, $years); var_dump($differences);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["2018-05"]=> float(10) ["2018-06"]=> float(100) }

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