3v4l.org

run code in 300+ PHP versions simultaneously
<?php restore_error_handler(); function myErrorHandler ($errno, $errstr, $errfile, $errline) { switch ($errno) { case FATAL: echo "<b>FATAL</b> [$errno] $errstr<br>\n"; echo " Fatal error in line ".$errline." of file ".$errfile; echo ", PHP ".PHP_VERSION." (".PHP_OS.")<br>\n"; echo "Aborting...<br>\n"; exit (1); break; case ERROR: echo "<b>ERROR</b> [$errno] $errstr<br>\n"; break; case WARNING: echo "<b>WARNING</b> [$errno] $errstr<br>\n"; break; default: echo "Unkown error type: [$errno] $errstr<br>\n"; break; } } // funzione di prova del gestore di errore function scale_by_log ($vect, $scale) { if ( !is_numeric($scale) || $scale <= 0 ) trigger_error("log(x) for x <= 0 is undefined, you used: scale = $scale", FATAL); if (!is_array($vect)) { trigger_error("Incorrect input vector, array of values expected", ERROR); return null; } for ($i=0; $i<count($vect); $i++) { if (!is_numeric($vect[$i])) trigger_error("Value at position $i is not a number, using 0 (zero)", WARNING); $temp[$i] = log($scale) * $vect[$i]; } return $temp; } // configura il gestore dell'errore definito dall'utente $old_error_handler = set_error_handler("myErrorHandler"); // attiva alcuni errori, definendo prima un array misto con elementi non numerici echo "vector a\n"; $a = array(2,3,"foo",5.5,43.3,21.11); print_r($a); // genera il secondo array, generando un avviso echo "----\nvector b - a warning (b = log(PI) * a)\n"; $b = scale_by_log($a, M_PI); print_r($b); // questo è il problema, passiamo una stringa al posto di un array echo "----\nvector c - an error\n"; $c = scale_by_log("not array",2.3); var_dump($c); // errore critico, il log di zero o di un numero negativo non è definito echo "----\nvector d - fatal error\n"; $d = scale_by_log($a, -2.5); ?>

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.3.60.0130.00316.88
8.3.50.0140.00322.22
8.3.40.0120.00618.92
8.3.30.0140.00719.21
8.3.20.0060.00320.59
8.3.10.0000.00823.66
8.3.00.0080.00417.88
8.2.180.0140.00716.75
8.2.170.0140.00022.96
8.2.160.0030.01020.65
8.2.150.0030.00724.18
8.2.140.0040.00424.66
8.2.130.0100.01026.16
8.2.120.0040.00422.51
8.2.110.0030.00722.34
8.2.100.0090.00318.03
8.2.90.0050.00319.46
8.2.80.0040.00418.05
8.2.70.0000.01117.50
8.2.60.0040.00417.93
8.2.50.0000.00818.07
8.2.40.0040.00418.34
8.2.30.0000.00918.34
8.2.20.0000.00817.92
8.2.10.0040.00418.31
8.2.00.0070.00318.06
8.1.280.0090.00625.92
8.1.270.0030.00622.26
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00624.13
8.1.230.0070.00719.46
8.1.220.0080.00017.74
8.1.210.0060.00318.77
8.1.200.0040.00417.60
8.1.190.0040.00417.76
8.1.180.0000.00818.10
8.1.170.0050.00318.75
8.1.160.0070.00022.31
8.1.150.0040.00418.91
8.1.140.0030.00517.54
8.1.130.0000.00718.03
8.1.120.0070.00017.59
8.1.110.0000.00717.72
8.1.100.0070.00017.69
8.1.90.0000.00717.62
8.1.80.0000.00717.54
8.1.70.0080.00017.64
8.1.60.0040.00417.73
8.1.50.0040.00417.70
8.1.40.0080.00017.72
8.1.30.0000.00817.71
8.1.20.0000.00817.83
8.1.10.0000.00717.78
8.1.00.0030.00517.70
8.0.300.0040.00418.77
8.0.290.0070.00017.25
8.0.280.0050.00218.72
8.0.270.0070.00017.50
8.0.260.0060.00017.32
8.0.250.0000.00717.14
8.0.240.0040.00417.11
8.0.230.0030.00317.20
8.0.220.0070.00017.05
8.0.210.0030.00317.03
8.0.200.0040.00417.11
8.0.190.0080.00017.26
8.0.180.0070.00017.09
8.0.170.0040.00417.23
8.0.160.0040.00417.04
8.0.150.0050.00217.14
8.0.140.0040.00417.02
8.0.130.0040.00413.58
8.0.120.0030.00617.15
8.0.110.0040.00417.03
8.0.100.0000.00817.02
8.0.90.0040.00417.19
8.0.80.0120.00316.96
8.0.70.0040.00417.02
8.0.60.0090.00017.22
8.0.50.0050.00317.04
8.0.30.0130.00817.18
8.0.20.0120.00617.40
8.0.10.0040.00417.23
8.0.00.0140.00716.94
7.4.330.0070.00015.00
7.4.320.0000.00816.75
7.4.300.0070.00016.83
7.4.290.0000.01116.78
7.4.280.0030.00316.73
7.4.270.0000.00716.83
7.4.260.0000.00716.79
7.4.250.0000.00816.65
7.4.240.0070.00016.77
7.4.230.0070.00016.87
7.4.220.0190.00616.66
7.4.210.0090.00716.68
7.4.200.0030.00316.95
7.4.190.0070.00016.99
7.4.160.0100.00716.65
7.4.150.0110.00617.40
7.4.140.0100.00817.86
7.4.130.0110.00816.67
7.4.120.0120.00716.73
7.4.110.0060.01216.68
7.4.100.0090.00916.69
7.4.90.0110.00916.65
7.4.80.0140.00419.39
7.4.70.0110.00616.73
7.4.60.0100.00716.62
7.4.50.0040.00416.76
7.4.40.0110.00722.77
7.4.30.0100.00616.70
7.4.00.0060.00615.14
7.3.330.0030.00313.68
7.3.320.0050.00013.77
7.3.310.0040.00416.57
7.3.300.0000.00716.56
7.3.290.0040.01116.64
7.3.280.0090.01016.57
7.3.270.0160.00317.40
7.3.260.0030.01416.61
7.3.250.0110.00816.73
7.3.240.0090.00916.69
7.3.230.0100.00716.76
7.3.210.0120.00616.57
7.3.200.0130.01019.39
7.3.190.0150.00516.59
7.3.180.0060.01016.71
7.3.170.0120.00616.53
7.3.160.0100.01016.57
7.3.120.0100.00615.06
7.2.330.0090.01116.70
7.2.320.0080.01217.00
7.2.310.0060.01216.86
7.2.300.0120.00616.98
7.2.290.0130.00716.60
7.2.60.0060.00817.21
7.2.00.0030.01019.84
7.1.200.0040.00815.87
7.1.100.0060.00618.50
7.1.70.0040.00417.38
7.1.60.0110.01519.33
7.1.50.0260.01034.95
7.1.00.0030.07722.80
7.0.200.0060.00317.21
7.0.140.0030.06722.50
7.0.60.0000.04022.03
7.0.50.0030.06018.43
7.0.40.0070.06020.52
7.0.30.0300.03720.58
7.0.20.0230.04720.38
7.0.10.0070.08320.48
7.0.00.0100.07020.55
5.6.280.0000.07721.53
5.6.210.0130.05720.93
5.6.200.0030.04318.52
5.6.190.0070.04020.78
5.6.180.0330.05320.83
5.6.170.0230.04020.79
5.6.160.0070.09020.75
5.6.150.0100.07718.60
5.6.140.0070.07018.53
5.6.130.0130.06718.46
5.6.120.0100.08021.43
5.6.110.0100.08021.48
5.6.100.0070.08321.47
5.6.90.0070.05021.43
5.6.80.0070.06720.87
5.5.350.0070.04320.78
5.5.340.0030.06318.29
5.5.330.0070.08320.77
5.5.320.0370.05720.82
5.5.310.0200.07720.81
5.5.300.0100.04318.29
5.5.290.0030.07018.29
5.5.280.0030.05321.30
5.5.270.0070.08021.25
5.5.260.0000.04321.33
5.5.250.0200.07320.92
5.5.240.0170.04320.63
5.4.450.0170.05719.83
5.4.440.0870.06019.67
5.4.430.0000.07019.71
5.4.420.0600.06319.74
5.4.410.0730.06019.24
5.4.400.0370.05719.41
5.4.390.0800.05019.41
5.4.380.0530.07018.61
5.4.370.0400.05718.65
5.4.360.0300.08718.78
5.4.350.0400.07018.97
5.4.340.0330.05318.60
5.4.320.0070.04012.57
5.4.310.0110.04212.56
5.4.300.0060.04512.57
5.4.290.0020.04312.56
5.4.280.0050.03712.46
5.4.270.0070.04212.46
5.4.260.0060.04712.46
5.4.250.0060.04412.46
5.4.240.0060.04512.46
5.4.230.0060.03712.45
5.4.220.0070.04112.45
5.4.210.0110.03712.45
5.4.200.0020.04212.45
5.4.190.0090.04812.42
5.4.180.0150.04412.42
5.4.170.0180.04012.43
5.4.160.0150.04412.43
5.4.150.0210.03912.42
5.4.140.0280.06112.11
5.4.130.0180.04512.09
5.4.120.0210.04112.05
5.4.110.0410.07912.05
5.4.100.0180.04312.04
5.4.90.0230.04112.05
5.4.80.0200.04912.04
5.4.70.0200.04212.04
5.4.60.0140.04412.04
5.4.50.0160.04112.04
5.4.40.0270.09612.03
5.4.30.0170.04412.02
5.4.20.0220.03912.03
5.4.10.0210.06712.03
5.4.00.0200.04011.52
5.3.290.0080.04612.80
5.3.280.0050.04412.73
5.3.270.0170.04712.73
5.3.260.0190.04412.73
5.3.250.0170.04412.72
5.3.240.0170.04612.72
5.3.230.0160.04812.71
5.3.220.0240.04012.69
5.3.210.0180.04512.68
5.3.200.0170.04312.68
5.3.190.0280.06412.69
5.3.180.0160.04412.68
5.3.170.0110.04912.68
5.3.160.0150.04912.68
5.3.150.0160.04512.68
5.3.140.0150.04712.67
5.3.130.0140.04812.67
5.3.120.0190.04312.67
5.3.110.0160.04512.67
5.3.100.0170.04512.16
5.3.90.0260.06512.14
5.3.80.0200.04412.13
5.3.70.0190.04312.12
5.3.60.0270.06312.11
5.3.50.0190.04112.06
5.3.40.0130.04912.06
5.3.30.0180.04812.02
5.3.20.0310.09211.80
5.3.10.0150.04311.77
5.3.00.0140.04311.75
5.2.170.0150.0329.27
5.2.160.0130.0339.27
5.2.150.0150.0329.27
5.2.140.0150.0329.27
5.2.130.0170.0319.22
5.2.120.0120.0369.22
5.2.110.0120.0389.23
5.2.100.0120.0359.23
5.2.90.0170.0299.23
5.2.80.0160.0349.23
5.2.70.0170.0309.22
5.2.60.0180.0299.17
5.2.50.0130.0359.14
5.2.40.0160.0329.12
5.2.30.0110.0359.10
5.2.20.0150.0349.11
5.2.10.0130.0339.02
5.2.00.0110.0348.86
5.1.60.0100.0308.16
5.1.50.0070.0368.15
5.1.40.0120.0338.14
5.1.30.0240.0508.49
5.1.20.0240.0528.51
5.1.10.0110.0328.23
5.1.00.0080.0348.23
5.0.50.0110.0246.71
5.0.40.0110.0216.57
5.0.30.0080.0376.39
5.0.20.0100.0236.37
5.0.10.0130.0206.34
5.0.00.0150.0626.34
4.4.90.0070.0214.78
4.4.80.0060.0204.76
4.4.70.0100.0164.75
4.4.60.0090.0174.75
4.4.50.0090.0184.77
4.4.40.0110.0304.73
4.4.30.0090.0184.76
4.4.20.0050.0234.84
4.4.10.0060.0204.85
4.4.00.0080.0324.75
4.3.110.0130.0214.67
4.3.100.0130.0234.66
4.3.90.0090.0194.64
4.3.80.0100.0264.64
4.3.70.0070.0194.64
4.3.60.0080.0174.64
4.3.50.0070.0204.64
4.3.40.0060.0304.59
4.3.30.0070.0183.41
4.3.20.0090.0173.39
4.3.10.0090.0173.34
4.3.00.0030.0237.80

preferences:
38.89 ms | 401 KiB | 5 Q