3v4l.org

run code in 300+ PHP versions simultaneously
<?php $scandir = scandir('c:/keycounter'); $stats = array(); foreach($scandir as $filename){ if(substr($filename, -4) !== '.day') continue; $date = substr($filename, 0, -4); $stats[$date]= array('k' => 0, 'm' => 0); $content = file_get_contents('c:/keycounter/'.$filename); $lines = explode("\n", $content); foreach($lines as $line){ if($line === '') { continue; } $exp2 = explode(",", $line); $stats[$date]['k']+=intval($exp2[0]); $stats[$date]['m']+=intval($exp2[1]); } } $kplot = array(); $mplot = array(); foreach($stats as $date => $stat){ $kplot[$date] = $stat['k']; $mplot[$date] = $stat['m']; } function time_flot($data){ ksort($data); $rand = md5(rand(100000,10000000)); $dt = ''; foreach ($data as $key => $val) { $dt.='[' . date('U', strtotime($key)) * 1000 .','. $val . '],'; } ob_start(); ?> <div id="flot-<?php echo $rand ?>" style="height:100%; width: 100%; min-height: 200px; min-width: 300px;"></div> <script type="text/javascript"> $(function() { var d = [<?php echo $dt ?>]; // helper for returning the weekends in a period function weekendAreas(axes) { var markings = [], d = new Date(axes.xaxis.min); // go to the first Saturday d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7)); d.setUTCSeconds(0); d.setUTCMinutes(0); d.setUTCHours(0); var i = d.getTime(); // when we dont set yaxis, the rectangle automatically // extends to infinity upwards and downwards do { markings.push({ xaxis: { from: i, to: i + 24 * 60 * 60 * 1000 } }); i += 7 * 24 * 60 * 60 * 1000; } while (i < axes.xaxis.max); return markings; } var options = { xaxis: { mode: "time", tickLength: 5, timeformat: "%d %b", monthNames: ["jan", "feb", "mar", "apr", "mai", "jun", "jul", "aug", "sep", "okt", "nov", "des"] }, selection: { mode: "x" }, grid: { markings: weekendAreas, hoverable: true, }, }; $("<div id='flot-<?php echo $rand ?>-tooltip'></div>").css({ position: "absolute", display: "none", border: "1px solid #ddd", padding: "2px", "background-color": "#eee", opacity: 0.80 }).appendTo("body"); var plot = $.plot("#flot-<?php echo $rand ?>", [d], options); $("#flot-<?php echo $rand ?>").bind("plothover", function (event, pos, item) { if (item) { var x = item.datapoint[0].toFixed(), y = item.datapoint[1].toFixed(); var date = new Date(x * 1); $("#flot-<?php echo $rand ?>-tooltip").html(date.getFullYear()+ "/" + (date.getMonth() + 1) + "/" + date.getDate() + " ("+ y + ")") .css({top: item.pageY+0, left: item.pageX+25}) .fadeIn(200); } else { $("#flot-<?php echo $rand ?>-tooltip").hide(); } }); // now connect the two }); </script> <?php $str = ob_get_contents(); ob_end_clean(); return $str; } ?> <script language="javascript" type="text/javascript" src="jquery-1.9.1.min.js"></script> <script language="javascript" type="text/javascript" src="jquery.flot.js"></script> <script language="javascript" type="text/javascript" src="jquery.flot.time.js"></script> <style> .flot{ background: white; border-radius: 10px; border: 1px solid orange; padding: 10px; margin-bottom: 10px; } </style> <?php echo 'avg_k: ' . intval(array_sum($kplot) / count($kplot)) . '<br/>'; ?> <div class="plot" style="width: 1500px; height: 400px;"> <?php echo time_flot($kplot);?> </div> <br/> <?php echo 'avg_m: ' . intval(array_sum($mplot) / count($mplot)) . '<br/>'; ?> <div class="plot" style="width: 1500px; height: 400px;"> <?php echo time_flot($mplot);?> </div>

Abusive script

This script was stopped while abusing our resources

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)
8.0.120.0100.00213.33
8.0.110.0090.00213.38
8.0.100.0060.00613.38
8.0.90.0080.00413.32
8.0.80.0080.00413.36
8.0.70.0060.00613.30
8.0.60.0110.00013.36
8.0.50.0080.00413.33
8.0.30.0060.00613.40
8.0.20.0030.00513.36
8.0.10.0060.00013.46
8.0.00.0030.00313.55
7.4.250.0000.00513.28
7.4.240.0000.00613.18
7.4.230.0060.00013.25
7.4.220.0030.00313.20
7.4.210.0060.00613.20
7.4.200.0030.00513.29
7.4.190.0070.00013.45
7.4.180.0060.00013.39
7.4.160.0000.00513.32
7.4.150.0060.00013.18
7.4.140.0030.00313.20
7.4.130.0040.00413.11
7.4.120.0000.00713.20
7.4.110.0060.00013.25
7.4.100.0090.00213.38
7.4.90.0000.01313.26
7.4.80.0120.00013.23
7.4.70.0130.00013.12
7.4.60.0140.00013.20
7.4.50.0100.00313.07
7.4.40.0060.00312.91
7.4.30.0100.00013.11
7.4.20.0050.00313.16
7.4.10.0040.00813.21
7.4.00.0080.00413.05
7.3.310.0110.00313.36
7.3.300.0090.00413.11
7.3.290.0040.00813.21
7.3.280.0080.00413.32
7.3.270.0110.00013.14
7.3.260.0090.00313.24
7.3.250.0050.01013.27
7.3.240.0120.00213.20
7.3.230.0000.01313.30
7.3.220.0070.00713.34
7.3.210.0070.00713.34
7.3.200.0090.00513.16
7.3.190.0000.01213.16
7.3.180.0100.00213.33
7.3.170.0100.00313.14
7.3.160.0130.00013.37
7.3.150.0060.00613.34
7.3.140.0110.00213.41
7.3.130.0130.00013.15
7.3.120.0060.00613.10
7.3.110.0060.00613.22
7.3.100.0130.00013.20
7.3.90.0090.00313.42
7.3.80.0040.00813.18
7.3.70.0130.00013.30
7.3.60.0090.00313.39
7.3.50.0130.00013.41
7.3.40.0100.00213.48
7.3.30.0040.00813.40
7.3.20.0090.00415.19
7.3.10.0080.00415.18
7.3.00.0090.00415.07
7.2.340.0120.00013.28
7.2.330.0060.00713.41
7.2.320.0120.00013.41
7.2.310.0120.00013.41
7.2.300.0000.01313.42
7.2.290.0090.00313.23
7.2.280.0130.00013.36
7.2.270.0040.00813.41
7.2.260.0100.00313.22
7.2.250.0130.00013.34
7.2.240.0090.00413.42
7.2.230.0090.00313.47
7.2.220.0100.00213.39
7.2.210.0130.00013.22
7.2.200.0120.00213.38
7.2.190.0130.00013.57
7.2.180.0080.00413.51
7.2.170.0040.00813.49
7.2.160.0080.00513.54
7.2.150.0100.00315.23
7.2.140.0100.00315.25
7.2.130.0080.00415.50
7.2.120.0130.00015.40
7.2.110.0130.00015.42
7.2.100.0060.00615.38
7.2.90.0000.01215.27
7.2.80.0090.00415.46
7.2.70.0090.00315.35
7.2.60.0100.00315.28
7.2.50.0130.00015.21
7.2.40.0130.00015.21
7.2.30.0100.00315.21
7.2.20.0000.01415.47
7.2.10.0140.00015.45
7.2.00.0090.00415.45
7.1.330.0040.00814.38
7.1.320.0060.00614.32
7.1.310.0080.00314.38
7.1.300.0090.00314.36
7.1.290.0080.00414.29
7.1.280.0080.00414.35
7.1.270.0080.00414.20
7.1.260.0040.00814.18
7.1.250.0090.00314.28
7.1.240.0110.00014.23
7.1.230.0080.00414.20
7.1.220.0090.00314.35
7.1.210.0100.00214.15
7.1.200.0120.00014.18
7.1.190.0120.00014.36
7.1.180.0100.00214.23
7.1.170.0120.00014.09
7.1.160.0080.00414.29
7.1.150.0040.00814.11
7.1.140.0100.00214.29
7.1.130.0090.00314.28
7.1.120.0060.00614.26
7.1.110.0100.00214.27
7.1.100.0090.00414.27
7.1.90.0130.00014.20
7.1.80.0130.00014.39
7.1.70.0040.00714.20
7.1.60.0130.00014.30
7.1.50.0100.00314.36
7.1.40.0060.00614.38
7.1.30.0080.00414.40
7.1.20.0130.00014.16
7.1.10.0070.00514.30
7.1.00.0100.00214.12
7.0.330.0120.00014.08
7.0.320.0000.01214.16
7.0.310.0040.00814.15
7.0.300.0080.00414.01
7.0.290.0120.00014.10
7.0.280.0110.00014.11
7.0.270.0120.00014.07
7.0.260.0120.00014.07
7.0.250.0040.00814.16
7.0.240.0090.00214.30
7.0.230.0120.00014.37
7.0.220.0060.00614.34
7.0.210.0080.00414.28
7.0.200.0080.00414.30
7.0.190.0120.00014.10
7.0.180.0120.00014.13
7.0.170.0090.00214.25
7.0.160.0090.00314.23
7.0.150.0150.00014.14
7.0.140.0090.00314.19
7.0.130.0120.00014.28
7.0.120.0090.00314.12
7.0.110.0080.00413.97
7.0.100.0120.00014.15
7.0.90.0060.00614.12
7.0.80.0120.00014.10
7.0.70.0070.00514.12
7.0.60.0060.00614.01
7.0.50.0080.00414.16
7.0.40.0040.00714.16
7.0.30.0030.00914.09
7.0.20.0060.00614.08
7.0.10.0090.00314.17
7.0.00.0090.00314.13
5.6.400.0110.00012.80
5.6.390.0090.00312.61
5.6.380.0070.00512.70
5.6.370.0040.00812.77
5.6.360.0050.00612.53
5.6.350.0060.00612.80
5.6.340.0110.00012.49
5.6.330.0080.00312.61
5.6.320.0070.00412.50
5.6.310.0070.00512.81
5.6.300.0070.00312.72
5.6.290.0090.00212.68
5.6.280.0000.01112.69
5.6.270.0110.00012.58
5.6.260.0060.00612.84
5.6.250.0110.00012.50
5.6.240.0110.00012.59
5.6.230.0110.00012.68
5.6.220.0080.00412.83
5.6.210.0060.00612.99
5.6.200.0080.00312.89
5.6.190.0080.00312.80
5.6.180.0090.00312.65
5.6.170.0060.00612.95
5.6.160.0090.00212.88
5.6.150.0120.00012.68
5.6.140.0110.00012.80
5.6.130.0080.00412.89
5.6.120.0120.00012.96
5.6.110.0120.00012.90
5.6.100.0060.00612.89
5.6.90.0060.00612.68
5.6.80.0110.00012.84
5.6.70.0070.00412.96
5.6.60.0040.00712.67
5.6.50.0080.00312.83
5.6.40.0110.00012.73
5.6.30.0050.00512.55
5.6.20.0090.00212.68
5.6.10.0070.00312.84
5.6.00.0060.00612.54
5.5.380.0060.00612.72
5.5.370.0000.01113.02
5.5.360.0060.00612.75
5.5.350.0080.00412.54
5.5.340.0090.00312.65
5.5.330.0090.00212.83
5.5.320.0060.00612.60
5.5.310.0060.00612.65
5.5.300.0060.00612.70
5.5.290.0100.00312.54
5.5.280.0130.00012.54
5.5.270.0130.00012.48
5.5.260.0060.00612.66
5.5.250.0100.00212.95
5.5.240.0090.00312.77
5.5.230.0120.00012.54
5.5.220.0060.00612.66
5.5.210.0000.01112.77
5.5.200.0080.00412.76
5.5.190.0110.00012.69
5.5.180.0110.00012.75
5.5.170.0080.00312.61
5.5.160.0060.00412.53
5.5.150.0050.00512.52
5.5.140.0070.00412.64
5.5.130.0070.00512.56
5.5.120.0090.00312.41
5.5.110.0040.00812.46
5.5.100.0080.00412.46
5.5.90.0050.00512.64
5.5.80.0080.00212.82
5.5.70.0000.01212.60
5.5.60.0060.00612.71
5.5.50.0110.00012.59
5.5.40.0060.00611.94
5.5.30.0060.00411.96
5.5.20.0070.00411.82
5.5.10.0040.00611.85
5.5.00.0090.00111.61
5.4.450.0070.00312.50
5.4.440.0080.00312.64
5.4.430.0050.00512.50
5.4.420.0110.00012.69
5.4.410.0070.00312.85
5.4.400.0060.00612.64
5.4.390.0090.00212.65
5.4.380.0110.00012.50
5.4.370.0080.00412.50
5.4.360.0070.00412.45
5.4.350.0080.00312.65
5.4.340.0110.00012.61
5.4.330.0050.00512.79
5.4.320.0090.00312.67
5.4.310.0110.00012.78
5.4.300.0110.00012.64
5.4.290.0080.00412.85
5.4.280.0090.00312.60
5.4.200.0070.00411.13
5.4.190.0030.00711.05
5.4.180.0030.00910.64
5.4.170.0100.00310.98
5.4.160.0040.00711.00
5.4.150.0070.00510.88
5.4.140.0080.00410.62
5.4.130.0060.00610.73
5.4.120.0070.00711.01
5.4.110.0080.00411.06
5.4.100.0000.01111.11
5.4.90.0040.00811.18
5.4.80.0090.00410.86
5.4.70.0040.00810.98
5.4.60.0000.01210.61
5.4.50.0040.00810.80
5.4.40.0080.00411.06
5.4.30.0030.00610.77
5.4.20.0090.00310.96
5.4.10.0050.00510.93
5.4.00.0030.00710.81
5.3.270.0030.00610.68
5.3.260.0000.01010.58
5.3.250.0030.00710.34
5.3.240.0030.00710.57
5.3.230.0040.00810.52
5.3.220.0100.00010.31
5.3.210.0060.00310.58
5.3.200.0060.00610.29
5.3.190.0060.00610.52
5.3.180.0110.00010.77
5.3.170.0030.00710.73
5.3.160.0060.00610.69
5.3.150.0030.00610.75
5.3.140.0000.01010.68
5.3.130.0040.00810.41
5.3.120.0000.01110.46
5.3.110.0100.00010.63
5.3.100.0000.00910.67
5.3.90.0060.00310.53
5.3.80.0070.00310.61
5.3.70.0070.00310.59
5.3.60.0060.00310.57
5.3.50.0000.01010.65
5.3.40.0030.00710.34
5.3.30.0040.00410.38
5.3.20.0100.00010.32
5.3.10.0070.00310.24
5.3.00.0070.00410.20

preferences:
43.37 ms | 401 KiB | 5 Q