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"; die('You cannot call this script directly !'); 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.0070.01016.75
8.3.50.0120.00822.19
8.3.40.0080.00619.09
8.3.30.0100.00318.92
8.3.20.0040.00420.61
8.3.10.0090.00023.61
8.3.00.0000.00720.93
8.2.180.0180.00416.88
8.2.170.0040.01122.96
8.2.160.0100.00322.35
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00422.37
8.2.110.0060.00319.56
8.2.100.0060.00618.09
8.2.90.0040.00419.30
8.2.80.0050.00317.97
8.2.70.0100.00317.88
8.2.60.0060.00318.29
8.2.50.0080.00018.07
8.2.40.0040.00419.64
8.2.30.0000.00818.31
8.2.20.0030.00517.89
8.2.10.0060.00317.95
8.2.00.0080.00017.96
8.1.280.0120.00625.92
8.1.270.0000.00824.16
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0090.00022.27
8.1.230.0080.00319.27
8.1.220.0040.00417.80
8.1.210.0000.00818.77
8.1.200.0040.00417.60
8.1.190.0080.00017.78
8.1.180.0080.00018.10
8.1.170.0030.00518.68
8.1.160.0000.00822.14
8.1.150.0000.00818.74
8.1.140.0000.00717.66
8.1.130.0000.00717.95
8.1.120.0000.00817.54
8.1.110.0050.00317.61
8.1.100.0000.00717.61
8.1.90.0000.00817.65
8.1.80.0030.00317.68
8.1.70.0030.00317.59
8.1.60.0080.00417.67
8.1.50.0000.00817.63
8.1.40.0040.00417.77
8.1.30.0040.00417.71
8.1.20.0000.00817.81
8.1.10.0030.00517.80
8.1.00.0060.00317.68
8.0.300.0050.00218.77
8.0.290.0000.00816.88
8.0.280.0070.00018.70
8.0.270.0040.00417.52
8.0.260.0040.00417.13
8.0.250.0040.00417.23
8.0.240.0040.00317.18
8.0.230.0070.00017.22
8.0.220.0030.00517.05
8.0.210.0000.00717.16
8.0.200.0040.00417.22
8.0.190.0000.00717.21
8.0.180.0000.00817.05
8.0.170.0090.00017.19
8.0.160.0000.00717.09
8.0.150.0040.00417.07
8.0.140.0000.00817.14
8.0.130.0030.00313.62
8.0.120.0000.00817.17
8.0.110.0000.00917.14
8.0.100.0000.00817.04
8.0.90.0030.00517.14
8.0.80.0060.01217.00
8.0.70.0040.00417.06
8.0.60.0040.00417.00
8.0.50.0040.00417.04
8.0.30.0140.01217.22
8.0.20.0110.00817.40
8.0.10.0070.00017.26
8.0.00.0070.01416.74
7.4.330.0000.00515.20
7.4.320.0000.00716.85
7.4.300.0030.00316.91
7.4.290.0030.00316.80
7.4.280.0070.00016.90
7.4.270.0000.00816.85
7.4.260.0030.00316.84
7.4.250.0050.00316.85
7.4.240.0020.00516.65
7.4.230.0000.00816.81
7.4.220.0150.00416.61
7.4.210.0070.00816.69
7.4.200.0070.00016.63
7.4.190.0000.00716.90
7.4.160.0170.00016.63
7.4.150.0060.01217.40
7.4.140.0120.00717.86
7.4.130.0180.00216.78
7.4.120.0040.01416.56
7.4.110.0000.01816.81
7.4.100.0060.01216.77
7.4.90.0080.01216.64
7.4.80.0110.00716.73
7.4.70.0040.01716.79
7.4.60.0030.01316.64
7.4.50.0030.00316.91
7.4.40.0070.00722.77
7.4.30.0100.00716.78
7.4.10.0100.01015.39
7.4.00.0080.01015.17
7.3.330.0030.00313.77
7.3.320.0000.00513.62
7.3.310.0000.00716.75
7.3.300.0000.00716.66
7.3.290.0000.01416.62
7.3.280.0090.00916.53
7.3.270.0150.00417.40
7.3.260.0100.01016.75
7.3.250.0050.01416.54
7.3.240.0030.01316.81
7.3.230.0030.01316.74
7.3.210.0090.00916.65
7.3.200.0090.00919.39
7.3.190.0110.01116.59
7.3.180.0100.00716.60
7.3.170.0110.01016.77
7.3.160.0090.00616.55
7.3.130.0060.00615.29
7.3.120.0100.00815.21
7.3.110.0080.01115.12
7.3.100.0110.00515.36
7.3.90.0070.00715.11
7.3.80.0100.00615.15
7.3.70.0050.01015.03
7.3.60.0030.01015.19
7.3.50.0060.00515.13
7.3.40.0040.00715.25
7.3.30.0080.00314.92
7.3.20.0130.00317.15
7.3.10.0050.01117.15
7.3.00.0060.00716.93
7.2.330.0060.01216.68
7.2.320.0040.01416.73
7.2.310.0150.00316.86
7.2.300.0070.01016.68
7.2.290.0140.00416.70
7.2.260.0060.01215.53
7.2.250.0070.01215.34
7.2.240.0110.00815.25
7.2.230.0040.01215.20
7.2.220.0030.01115.45
7.2.210.0030.01415.45
7.2.200.0090.00315.37
7.2.190.0070.00915.43
7.2.180.0050.00715.15
7.2.170.0060.00615.43
7.2.160.0030.01015.43
7.2.150.0090.00317.24
7.2.140.0070.00517.08
7.2.130.0020.01117.22
7.2.120.0070.00517.22
7.2.110.0080.00917.33
7.2.100.0110.00617.24
7.2.90.0080.00517.13
7.2.80.0060.00517.38
7.2.70.0070.00917.13
7.2.60.0060.00817.36
7.2.50.0080.00617.13
7.2.40.0060.00817.19
7.2.30.0100.00617.25
7.2.20.0030.01017.26
7.2.10.0020.01117.34
7.2.00.0080.00618.08
7.1.330.0030.00816.14
7.1.320.0040.00916.06
7.1.310.0060.00916.25
7.1.300.0050.01115.91
7.1.290.0020.00816.04
7.1.280.0040.01116.07
7.1.270.0060.00416.21
7.1.260.0050.00615.89
7.1.250.0080.00516.17
7.1.240.0070.00415.96
7.1.230.0020.00916.15
7.1.220.0060.00415.98
7.1.210.0070.00816.21
7.1.200.0060.00616.02
7.1.190.0080.00816.01
7.1.180.0030.00816.01
7.1.170.0030.00616.00
7.1.160.0090.00616.08
7.1.150.0010.01416.06
7.1.140.0050.00815.93
7.1.130.0030.01116.25
7.1.120.0050.01016.06
7.1.110.0110.00316.12
7.1.100.0060.00916.95
7.1.90.0030.00816.00
7.1.80.0070.00315.93
7.1.70.0010.01016.53
7.1.60.0060.01017.13
7.1.50.0060.01016.41
7.1.40.0050.00816.14
7.1.30.0050.00816.09
7.1.20.0060.00616.09
7.1.10.0050.00515.90
7.1.00.0050.03118.37
7.0.330.0050.00715.61
7.0.320.0060.00515.70
7.0.310.0080.00815.69
7.0.300.0010.01015.50
7.0.290.0070.00715.72
7.0.280.0080.00515.68
7.0.270.0030.00815.82
7.0.260.0020.00915.74
7.0.250.0110.00015.75
7.0.240.0060.00815.64
7.0.230.0060.00515.60
7.0.220.0020.00815.79
7.0.210.0040.00815.62
7.0.200.0070.00716.19
7.0.190.0070.01215.76
7.0.180.0050.00815.78
7.0.170.0020.00915.65
7.0.160.0110.00315.66
7.0.150.0100.00515.75
7.0.140.0050.03117.84
7.0.130.0030.01315.75
7.0.120.0060.00415.68
7.0.110.0050.00715.77
7.0.100.0080.01617.28
7.0.90.0030.02217.27
7.0.80.0070.01717.21
7.0.70.0040.02017.36
7.0.60.0070.01817.29
7.0.50.0120.03217.35
7.0.40.0070.03316.08
7.0.30.0000.04216.06
7.0.20.0050.02416.01
7.0.10.0080.01615.88
7.0.00.0060.02915.86
5.6.400.0020.01114.69
5.6.390.0050.00814.83
5.6.380.0060.00914.60
5.6.370.0050.01314.70
5.6.360.0070.00714.86
5.6.350.0070.00714.81
5.6.340.0070.00714.43
5.6.330.0090.00615.02
5.6.320.0090.00614.90
5.6.310.0050.01014.69
5.6.300.0070.00414.70
5.6.290.0080.00614.72
5.6.280.0020.03216.96
5.6.270.0020.01114.73
5.6.260.0020.01014.84
5.6.250.0050.01816.95
5.6.240.0070.01716.91
5.6.230.0060.02116.79
5.6.220.0050.03016.80
5.6.210.0030.02116.81
5.6.200.0080.03016.90
5.6.190.0080.02616.99
5.6.180.0120.02816.95
5.6.170.0070.03617.06
5.6.160.0080.03017.06
5.6.150.0110.01616.98
5.6.140.0070.03117.09
5.6.130.0080.02216.94
5.6.120.0120.02916.93
5.6.110.0030.03917.03
5.6.100.0070.02216.89
5.6.90.0070.02316.84
5.6.80.0040.02116.73
5.6.70.0030.02616.79
5.6.60.0050.03016.63
5.6.50.0060.03216.70
5.6.40.0080.03016.70
5.6.30.0080.02916.73
5.6.20.0100.01816.68
5.6.10.0070.03316.79
5.6.00.0070.02916.79
5.5.380.0020.02216.77
5.5.370.0050.02316.67
5.5.360.0120.01316.69
5.5.350.0060.01816.57
5.5.340.0050.02416.85
5.5.330.0050.03516.85
5.5.320.0020.02716.95
5.5.310.0120.02816.84
5.5.300.0080.03016.88
5.5.290.0060.03216.91
5.5.280.0070.03216.86
5.5.270.0070.02916.86
5.5.260.0120.02416.93
5.5.250.0040.02116.66
5.5.240.0050.02016.79
5.5.230.0060.02616.59
5.5.220.0030.02216.68
5.5.210.0090.01916.58
5.5.200.0080.03016.45
5.5.190.0020.02516.61
5.5.180.0070.02016.51
5.5.170.0130.00114.34
5.5.160.0070.02916.73
5.5.150.0080.02716.54
5.5.140.0140.02816.61
5.5.130.0050.02816.66
5.5.120.0110.02916.61
5.5.110.0090.02416.64
5.5.100.0080.03116.50
5.5.90.0100.02616.60
5.5.80.0100.02816.72
5.5.70.0070.03216.56
5.5.60.0040.03216.55
5.5.50.0040.03316.44
5.5.40.0070.02016.43
5.5.30.0050.03016.65
5.5.20.0060.02616.63
5.5.10.0060.02216.55
5.5.00.0090.03016.48
5.4.450.0060.02814.82
5.4.440.0040.02614.77
5.4.430.0120.01414.79
5.4.420.0030.03314.83
5.4.410.0040.03214.91
5.4.400.0040.02714.71
5.4.390.0040.02914.68
5.4.380.0040.02714.73
5.4.370.0040.01714.73
5.4.360.0080.02514.68
5.4.350.0070.01414.71
5.4.340.0080.02814.74
5.4.330.0020.00712.36
5.4.320.0040.03314.72
5.4.310.0070.02614.66
5.4.300.0040.01714.68
5.4.290.0110.02414.71
5.4.280.0050.02814.74
5.4.270.0060.03114.77
5.4.260.0080.02814.71
5.4.250.0050.03014.74
5.4.240.0070.01814.73
5.4.230.0040.03214.72
5.4.220.0080.02514.71
5.4.210.0080.02514.72
5.4.200.0050.03014.76
5.4.190.0070.02614.67
5.4.180.0040.03314.66
5.4.170.0070.02914.77
5.4.160.0060.02714.72
5.4.150.0040.01914.75
5.4.140.0060.02813.82
5.4.130.0050.01913.82
5.4.120.0060.01713.82
5.4.110.0060.01513.88
5.4.100.0030.01713.83
5.4.90.0060.01313.88
5.4.80.0040.02113.88
5.4.70.0040.01813.85
5.4.60.0010.02913.78
5.4.50.0050.02113.86
5.4.40.0010.02213.78
5.4.30.0060.03113.85
5.4.20.0020.02913.83
5.4.10.0100.02713.78
5.4.00.0040.02113.64
5.3.290.0020.03113.28
5.3.280.0110.02113.21
5.3.270.0080.02613.28
5.3.260.0040.02513.26
5.3.250.0020.03013.25
5.3.240.0040.02913.23
5.3.230.0030.03113.21
5.3.220.0050.02713.26
5.3.210.0020.02813.23
5.3.200.0030.02613.20
5.3.190.0050.01613.21
5.3.180.0040.03013.20
5.3.170.0060.02913.25
5.3.160.0040.02113.21
5.3.150.0020.02913.21
5.3.140.0100.02313.24
5.3.130.0080.02413.22
5.3.120.0040.03213.23
5.3.110.0060.03013.24
5.3.100.0050.02913.03
5.3.90.0020.02713.02
5.3.80.0100.02513.05
5.3.70.0040.02313.08
5.3.60.0070.02913.01
5.3.50.0050.02713.04
5.3.40.0050.02013.04
5.3.30.0110.02212.98
5.3.20.0100.01812.95
5.3.10.0060.02512.90
5.3.00.0040.02312.95
5.2.170.0070.06011.39
5.2.160.0070.05711.68
5.2.150.0070.05711.46
5.2.140.0030.06311.39
5.2.130.0070.05711.62
5.2.120.0130.02711.46
5.2.110.0030.06311.54
5.2.100.0100.05711.40
5.2.90.0030.06311.43
5.2.80.0100.06011.55
5.2.70.0130.05011.53
5.2.60.0030.06311.50
5.2.50.0070.05711.46
5.2.40.0070.06011.25
5.2.30.0070.06011.48
5.2.20.0030.06711.28
5.2.10.0030.06011.34
5.2.00.0070.06011.04
5.1.60.0070.04010.45
5.1.50.0000.06010.50
5.1.40.0100.04710.43
5.1.30.0000.05010.69
5.1.20.0030.06010.83
5.1.10.0100.05310.50
5.1.00.0030.05710.48
5.0.50.0030.0439.00
5.0.40.0030.0438.84
5.0.30.0070.0608.51
5.0.20.0000.0438.61
5.0.10.0000.0478.73
5.0.00.0000.0708.59
4.4.90.0030.0208.26
4.4.80.0100.0308.26
4.4.70.0030.0178.26
4.4.60.0030.0308.26
4.4.50.0030.0238.26
4.4.40.0030.0538.26
4.4.30.0030.0278.26
4.4.20.0030.0378.26
4.4.10.0000.0338.26
4.4.00.0070.0508.26
4.3.110.0000.0308.26
4.3.100.0070.0308.26
4.3.90.0030.0338.26
4.3.80.0070.0478.26
4.3.70.0000.0308.26
4.3.60.0000.0378.26
4.3.50.0070.0238.26
4.3.40.0130.0408.26
4.3.30.0000.0378.26
4.3.20.0070.0308.26
4.3.10.0000.0378.26
4.3.00.0000.0438.26

preferences:
61.8 ms | 401 KiB | 5 Q