3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDaysUnderTempDictionary(float $targetTemp): array { //This is just for mocking a CSV file $dataString = <<<EOT 2019,1,1,0,0.1 2019,1,1,1,0.4 2019,1,1,2,0.8 2019,1,1,3,1.3 2019,1,1,4,1.8 2020,1,1,0,-3.9 EOT; $stream = fopen('php://memory', 'r+'); fwrite($stream, $dataString); rewind($stream); $years = []; while ($data = fgetcsv($stream)) { $year = $data[0]; if ($data[4] <= $targetTemp) { if(!isset($years[$year])){ $years[$year] = 0; } $years[$year]++; } } foreach($years as $year => $hours){ $years[$year] = $hours / 24; } return $years; } var_dump(getDaysUnderTempDictionary(4));
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [2019]=> float(0.20833333333333334) [2020]=> float(0.041666666666666664) }

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