3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '2020-01; Starter1; 11,4% 2020-01; Starter2; 6,9% 2020-01; Starter3; 9,5% 2020-01; Starter4; 11,1% 2020-02; Starter1; 5,8% 2020-02; Starter2; 5,8% 2020-02; Starter3; 10,0% 2020-02; Starter4; 6,4%'; // normalise and group data $result = []; foreach(str_getcsv($str, "\n") as $row){ $row = array_map('trim', str_getcsv($row, ";")); $result[$row[0]][$row[1]] = $row[2]; } // loop over to specification echo 'Year; Starter1; Starter2; Starter3; Starter4'.PHP_EOL; foreach ($result as $year => $row) { echo $year.'; '; foreach ($row as $key => $col) echo $col.";".str_repeat(' ', (($v = strlen($key)-(strlen($col)-1)) && $v > 0) ? $v : 0); echo PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
Year; Starter1; Starter2; Starter3; Starter4 2020-01; 11,4%; 6,9%; 9,5%; 11,1%; 2020-02; 5,8%; 5,8%; 10,0%; 6,4%;

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:
56.09 ms | 405 KiB | 9 Q