3v4l.org

run code in 300+ PHP versions simultaneously
<?php restore_error_handler(); // funzione di gestione dell'errore 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 ('E_ERROR'); 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.0140.00716.88
8.3.50.0060.01522.09
8.3.40.0060.00919.04
8.3.30.0150.00019.38
8.3.20.0040.00420.43
8.3.10.0040.00423.80
8.3.00.0090.00019.63
8.2.180.0110.00418.66
8.2.170.0060.00922.96
8.2.160.0070.00720.51
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0140.00026.16
8.2.120.0000.00722.50
8.2.110.0000.00922.48
8.2.100.0090.00318.09
8.2.90.0000.00819.42
8.2.80.0060.00318.05
8.2.70.0060.00318.00
8.2.60.0000.00818.03
8.2.50.0030.00518.07
8.2.40.0040.00418.41
8.2.30.0040.00418.20
8.2.20.0050.00318.00
8.2.10.0000.00718.36
8.2.00.0040.00417.93
8.1.280.0060.00925.92
8.1.270.0100.01023.97
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00324.07
8.1.230.0030.00719.32
8.1.220.0040.00417.91
8.1.210.0030.00518.77
8.1.200.0060.00317.48
8.1.190.0040.00417.78
8.1.180.0040.00418.10
8.1.170.0080.00018.76
8.1.160.0050.00222.21
8.1.150.0040.00418.86
8.1.140.0040.00417.61
8.1.130.0000.00717.94
8.1.120.0060.00317.73
8.1.110.0000.00817.53
8.1.100.0040.00417.59
8.1.90.0040.00417.67
8.1.80.0030.00317.56
8.1.70.0000.00817.61
8.1.60.0040.00417.84
8.1.50.0020.00517.69
8.1.40.0000.00917.69
8.1.30.0030.00517.82
8.1.20.0080.00017.80
8.1.10.0000.00717.66
8.1.00.0000.00817.60
8.0.300.0080.00018.77
8.0.290.0000.00717.30
8.0.280.0000.00818.56
8.0.270.0000.00918.87
8.0.260.0070.00016.93
8.0.250.0000.00717.27
8.0.240.0000.00717.22
8.0.230.0000.00817.18
8.0.220.0030.00317.18
8.0.210.0000.00717.20
8.0.200.0030.00317.06
8.0.190.0070.00017.25
8.0.180.0000.00717.04
8.0.170.0020.00517.09
8.0.160.0000.00717.03
8.0.150.0000.00717.15
8.0.140.0040.00417.00
8.0.130.0030.00313.64
8.0.120.0050.00317.04
8.0.110.0060.00317.09
8.0.100.0040.00416.95
8.0.90.0000.00717.19
8.0.80.0110.00717.01
8.0.70.0030.00617.04
8.0.60.0040.00417.10
8.0.50.0000.00817.11
8.0.30.0100.01317.28
8.0.20.0110.00817.40
8.0.10.0040.00417.27
8.0.00.0110.01016.77
7.4.330.0030.00315.25
7.4.320.0000.00616.75
7.4.300.0030.00316.82
7.4.290.0040.00716.88
7.4.280.0030.00516.71
7.4.270.0000.00716.76
7.4.260.0030.00316.83
7.4.250.0040.00416.86
7.4.240.0020.00516.70
7.4.230.0070.00016.63
7.4.220.0070.01016.64
7.4.210.0030.01116.72
7.4.200.0000.00716.75
7.4.190.0070.00016.70
7.4.160.0120.00716.71
7.4.150.0100.00717.40
7.4.140.0120.00617.86
7.4.130.0120.00716.65
7.4.120.0080.00916.72
7.4.110.0100.00716.70
7.4.100.0100.01016.72
7.4.90.0100.01016.68
7.4.80.0090.01319.39
7.4.70.0040.01516.94
7.4.60.0040.01316.70
7.4.50.0050.00316.82
7.4.40.0080.00422.77
7.4.30.0080.00816.78
7.4.00.0100.00515.15
7.3.330.0050.00013.62
7.3.320.0030.00313.78
7.3.310.0050.00216.71
7.3.300.0070.00016.77
7.3.290.0060.01016.59
7.3.280.0100.00716.53
7.3.270.0060.01217.40
7.3.260.0070.01016.65
7.3.250.0130.00716.62
7.3.240.0170.00716.88
7.3.230.0070.01116.57
7.3.210.0080.00816.57
7.3.200.0130.01019.39
7.3.190.0070.01416.56
7.3.180.0110.00716.47
7.3.170.0030.01316.65
7.3.160.0150.00316.59
7.3.120.0090.00815.17
7.3.110.0100.00714.96
7.3.100.0070.00715.31
7.3.90.0050.01315.11
7.3.80.0060.00715.15
7.3.70.0100.00515.20
7.3.60.0040.00715.10
7.3.50.0070.00815.22
7.3.40.0060.00715.11
7.3.30.0020.01015.00
7.3.20.0080.00516.78
7.3.10.0040.00916.92
7.3.00.0040.00816.99
7.2.330.0060.01616.81
7.2.320.0130.00316.73
7.2.310.0060.01316.98
7.2.300.0070.01116.86
7.2.290.0040.01316.95
7.2.250.0070.01315.52
7.2.240.0070.01215.41
7.2.230.0080.00815.32
7.2.220.0070.00415.34
7.2.210.0100.00515.49
7.2.200.0090.00615.31
7.2.190.0050.01115.16
7.2.180.0040.00915.48
7.2.170.0030.01115.33
7.2.130.0000.00917.12
7.2.120.0000.01217.27
7.2.110.0130.00317.16
7.2.100.0030.01017.16
7.2.90.0160.00016.80
7.2.80.0030.00716.45
7.2.70.0030.01017.37
7.2.60.0090.00517.11
7.2.50.0090.00017.34
7.2.40.0000.01517.25
7.2.30.0040.00817.36
7.2.20.0070.01017.23
7.2.10.0030.00916.93
7.2.00.0050.01118.47
7.1.330.0050.01016.00
7.1.320.0080.00415.92
7.1.310.0070.00916.01
7.1.300.0060.00616.20
7.1.290.0070.00215.98
7.1.280.0040.00715.82
7.1.270.0070.00816.07
7.1.260.0050.00816.10
7.1.250.0040.00716.00
7.1.200.0250.00315.26
7.1.100.0070.00418.29
7.1.70.0000.00817.51
7.1.60.0090.01519.31
7.1.50.0100.00317.23
7.1.00.0000.07722.91
7.0.200.0070.00316.98
7.0.140.0070.07322.54
7.0.100.0030.08020.38
7.0.90.0100.06320.37
7.0.80.0270.05720.30
7.0.70.0370.07720.33
7.0.60.0270.07720.32
7.0.50.0070.05020.88
7.0.40.0130.07720.53
7.0.30.0030.05720.62
7.0.20.0170.08020.46
7.0.10.0130.08020.32
7.0.00.0070.08720.44
5.6.280.0030.07721.18
5.6.250.0170.04021.05
5.6.240.0170.04321.00
5.6.230.0100.06720.94
5.6.220.0030.08321.01
5.6.210.0000.05021.05
5.6.200.0070.09321.48
5.6.190.0070.07321.45
5.6.180.0100.06321.43
5.6.170.0070.08721.46
5.6.160.0070.07321.42
5.6.150.0130.07721.39
5.6.140.0030.05721.42
5.6.130.0170.07721.46
5.6.120.0000.07721.38
5.6.110.0130.08021.58
5.6.100.0100.04321.42
5.6.90.0070.06021.43
5.6.80.0070.05320.79
5.6.70.0070.04320.85
5.6.60.0070.08320.85
5.6.50.0100.04720.83
5.6.40.0070.05020.80
5.6.30.0200.07020.86
5.6.20.0070.07320.80
5.6.10.0130.07320.82
5.6.00.0100.04020.81
5.5.380.0100.03720.75
5.5.370.0100.07720.73
5.5.360.0070.04320.85
5.5.350.0030.06320.75
5.5.340.0100.08021.30
5.5.330.0130.04321.19
5.5.320.0170.06321.27
5.5.310.0000.08721.31
5.5.300.0130.06321.31
5.5.290.0070.06021.19
5.5.280.0300.06021.24
5.5.270.0130.07021.27
5.5.260.0100.08321.30
5.5.250.0070.07321.04
5.5.240.0000.05720.63
5.5.230.0000.05020.69
5.5.220.0070.07020.68
5.5.210.0070.08020.51
5.5.200.0030.07320.66
5.5.190.0030.08320.55
5.5.180.0070.06720.57
5.5.160.0100.06720.55
5.5.150.0130.07020.66
5.5.140.0100.07320.63
5.5.130.0130.06720.56
5.5.120.0000.05320.57
5.5.110.0030.08320.41
5.5.100.0170.04020.55
5.5.90.0200.05720.45
5.5.80.0170.06020.45
5.5.70.0100.07720.36
5.5.60.0200.04720.54
5.5.50.0130.07320.50
5.5.40.0230.04020.50
5.5.30.0070.07020.54
5.5.20.0100.08020.50
5.5.10.0070.04720.52
5.5.00.0070.04320.38
5.4.450.0070.07719.69
5.4.440.0130.03319.78
5.4.430.0070.09019.82
5.4.420.0100.03719.60
5.4.410.0130.06719.47
5.4.400.0070.07019.61
5.4.390.0070.06319.44
5.4.380.0030.04019.43
5.4.370.0070.04719.34
5.4.360.0000.05019.46
5.4.350.0000.04319.36
5.4.340.0070.06719.62
5.4.320.0100.04319.40
5.4.310.0070.07019.37
5.4.300.0000.08719.40
5.4.290.0030.05719.22
5.4.280.0100.04319.37
5.4.270.0030.08019.31
5.4.260.0200.07019.50
5.4.250.0270.05719.32
5.4.240.0070.04319.46
5.4.230.0030.07319.46
5.4.220.0070.07319.44
5.4.210.0130.06719.31
5.4.200.0130.06719.41
5.4.190.0030.08019.27
5.4.180.0100.05319.43
5.4.170.0130.06719.42
5.4.160.0130.06319.47
5.4.150.0130.06319.58
5.4.140.0030.08016.73
5.4.130.0000.04716.62
5.4.120.0130.06716.87
5.4.110.0070.07016.84
5.4.100.0070.07016.68
5.4.90.0100.07016.86
5.4.80.0130.06016.88
5.4.70.0030.07716.74
5.4.60.0100.06716.86
5.4.50.0030.07316.80
5.4.40.0070.06716.81
5.4.30.0000.08016.77
5.4.20.0130.03016.84
5.4.10.0100.06716.88
5.4.00.0000.04716.19
5.3.290.0070.08015.08
5.3.280.0070.07314.96
5.3.270.0070.06714.94
5.3.260.0130.04715.06
5.3.250.0070.07315.05
5.3.240.0100.07314.94
5.3.230.0070.04714.87
5.3.220.0100.07314.91
5.3.210.0000.08315.01
5.3.200.0030.08014.93
5.3.190.0070.07714.99
5.3.180.0100.07714.93
5.3.170.0130.04014.93
5.3.160.0000.05015.00
5.3.150.0100.06715.02
5.3.140.0100.07314.91
5.3.130.0030.07314.89
5.3.120.0070.07014.98
5.3.110.0000.04714.86
5.3.100.0200.06314.37
5.3.90.0070.07014.43
5.3.80.0000.06314.46
5.3.70.0000.05714.36
5.3.60.0100.03714.35
5.3.50.0100.05714.30
5.3.40.0070.07014.31
5.3.30.0070.04014.36
5.3.20.0000.08314.13
5.3.10.0070.06714.16
5.3.00.0100.07014.00
5.2.170.0100.04311.52
5.2.160.0070.03311.40
5.2.150.0130.05711.58
5.2.140.0100.03011.48
5.2.130.0030.06711.55
5.2.120.0030.06311.46
5.2.110.0070.06311.41
5.2.100.0070.06011.61
5.2.90.0000.06311.57
5.2.80.0000.04011.45
5.2.70.0070.05711.45
5.2.60.0100.05711.31
5.2.50.0100.05311.49
5.2.40.0030.03011.46
5.2.30.0100.04311.34
5.2.20.0030.04011.29
5.2.10.0100.05011.32
5.2.00.0070.05011.18
5.1.60.0070.02710.50
5.1.50.0070.05010.46
5.1.40.0030.02310.46
5.1.30.0030.05710.82
5.1.20.0070.05010.75
5.1.10.0000.05710.41
5.1.00.0000.06010.53
5.0.50.0030.0378.88
5.0.40.0030.0438.67
5.0.30.0000.0678.57
5.0.20.0030.0238.64
5.0.10.0030.0378.64
5.0.00.0070.0608.64
4.4.90.0070.0308.40
4.4.80.0030.0378.40
4.4.70.0000.0178.40
4.4.60.0000.0308.40
4.4.50.0070.0308.40
4.4.40.0100.0378.40
4.4.30.0000.0178.40
4.4.20.0000.0208.40
4.4.10.0000.0238.40
4.4.00.0000.0278.40
4.3.110.0000.0378.40
4.3.100.0000.0238.40
4.3.90.0000.0338.40
4.3.80.0030.0578.40
4.3.70.0070.0138.40
4.3.60.0030.0338.40
4.3.50.0070.0308.40
4.3.40.0100.0478.40
4.3.30.0030.0138.40
4.3.20.0000.0208.40
4.3.10.0000.0208.40
4.3.00.0000.0238.40

preferences:
39.63 ms | 401 KiB | 5 Q