3v4l.org

run code in 300+ PHP versions simultaneously
<?php $players=array( "Mickey Mantle", "Babe Ruth", "Yogi Berra", "Lou Gehrig", "Joe DiMaggio", "Derek Jeter", "Whitey Ford", "Roger Maris", "Reggie Jackson" ); $positions=array("P","C","1","2","SS","3","LF","CF","RF"); $batch=array(); echo "<table border=1>"; echo "<tr><th>#</th><th>",implode("</th><th>",$players),"</th></tr>"; for($week=1; $week<11; ++$week){ if($week==9){ foreach($players as $i=>$v){ $batch[$week][$i]=current(array_diff($positions,array_column($batch,$i))); } }elseif($week==10){ shuffle($positions); $batch[$week]=$positions; }else{ // weeks 1 - 8 while(!isset($batch[$week])){ shuffle($positions); $batch[$week]=$positions; if($week>1){ foreach($batch[$week] as $i=>$v){ if(sizeof(array_unique(array_column($batch,$i)))<$week){ // if vertical duplicates unset($batch[$week]); // trash the week, trigger rerun of loop break; // don't bother to assign positions for remaining players } } } } } echo "<tr><th>$week</th><td>",implode("</td><td>",$batch[$week]),"</td></tr>"; } echo "</table>"; ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.00.0070.04715.06
7.3.120.0100.21914.76
7.3.110.0150.10914.98
7.3.100.0070.10814.73
7.3.90.0100.10915.00
7.3.80.0030.03314.81
7.3.70.0070.08714.95
7.3.60.0060.02614.81
7.3.50.0060.01314.97
7.3.40.0030.02914.81
7.3.30.0030.06714.81
7.3.20.0070.12816.67
7.3.10.0070.12216.69
7.3.00.0050.14316.63
7.2.250.0130.07415.05
7.2.240.0100.35314.86
7.2.230.0070.11015.07
7.2.220.0030.33515.28
7.2.210.0030.15615.32
7.2.200.0030.20215.11
7.2.190.0100.18215.05
7.2.180.0030.14515.04
7.2.170.0110.02515.13
7.2.130.0100.39716.92
7.2.120.0100.24516.99
7.2.110.0120.05516.73
7.2.100.0020.09816.82
7.2.90.0070.23817.07
7.2.80.0070.05116.81
7.2.70.0100.09016.88
7.2.60.0070.07416.98
7.2.50.0080.37617.05
7.2.40.0080.20616.90
7.2.30.0070.11016.95
7.2.20.0050.07316.91
7.2.10.0070.13416.95
7.2.00.0090.12717.94
7.1.330.0030.31915.60
7.1.320.0030.50715.94
7.1.310.0070.34815.98
7.1.300.0000.20915.69
7.1.290.0090.77815.82
7.1.280.0030.26515.84
7.1.270.0030.47415.89
7.1.260.0070.09015.89
7.1.250.0030.05415.92
7.1.240.0070.06015.56
7.1.230.0030.48015.79
7.1.220.0070.29015.81
7.1.210.0000.05515.74
7.1.200.0070.08315.79
7.1.190.0130.13415.98
7.1.180.0030.60115.84
7.1.170.0071.10215.72
7.1.160.0030.08715.68
7.1.150.0170.06015.57
7.1.140.0100.28415.66
7.1.130.0101.25515.87
7.1.120.0160.02615.92
7.1.110.0000.04815.82
7.1.100.0100.23315.89
7.1.90.0060.01215.63
7.1.80.0070.04615.56
7.1.70.0050.12516.42
7.1.60.0070.63616.48
7.1.50.0050.17316.48
7.1.40.0100.19616.34
7.1.30.0110.04016.30
7.1.20.0030.07016.13
7.1.10.0100.22616.17
7.1.00.0060.15916.23
7.0.330.0000.47115.39
7.0.320.0100.07015.34
7.0.310.0000.62615.30
7.0.300.0130.58715.07
7.0.290.0100.10715.42
7.0.280.0130.09815.43
7.0.270.0100.33215.24
7.0.260.0070.11815.05
7.0.250.0130.29415.43
7.0.240.0060.07515.25
7.0.230.0030.36115.40
7.0.220.0100.09715.45
7.0.210.0030.18915.33
7.0.200.0070.05516.15
7.0.190.0080.23315.95
7.0.180.0020.26315.96
7.0.170.0080.30615.59
7.0.160.0070.15715.71
7.0.150.0130.26615.89
7.0.140.0100.21316.05
7.0.130.0070.11615.87
7.0.120.0020.12415.88
7.0.110.0070.77815.93
7.0.100.0060.23515.85
7.0.90.0050.46815.67
7.0.80.0070.27015.83
7.0.70.0030.26015.84
7.0.60.0020.51315.72
7.0.50.0050.07215.87
7.0.40.0020.13214.15
7.0.30.0070.27714.09
7.0.20.0050.40214.09
7.0.10.0080.62514.21
7.0.00.0030.19714.16
5.6.380.0100.69414.44

preferences:
64.12 ms | 403 KiB | 5 Q