3v4l.org

run code in 300+ PHP versions simultaneously
<?php // attiveremo la nostra gestione degli errori error_reporting(0); // funzione personalizzata di gestione dell'errore function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars) { // orario per la registrazione // definisce una matrice associativa con i messaggi di errore // in realtà i soli campi che saranno considerati sono // E_WARNING, E_NOTICE, E_USER_ERROR, // E_USER_WARNING and E_USER_NOTICE $errortype = array ( E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parsing Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice", E_STRICT => "Runtime Notice" ); // indica gli errori per i quali fare salvare la trace delle variabili $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE); $err .= $dt ; $err .= $errno ; $err .= $errortype[$errno]; $err .= $errmsg ; $err .= $filename ; $err .= $linenum ; if (in_array($errno, $user_errors)) { $err .= wddx_serialize_value($vars, "Variables"); } $err .= "</errorentry>\n\n"; // for testing // echo $err; // salva nell'errorlog e invia un e-mail se vi sono errori critici error_log($err, 3, "/usr/local/php4/error.log"); if ($errno == E_USER_ERROR) { mail("phpdev@example.com", "Critical User Error", $err); } } function distance($vect1, $vect2) { if (!is_array($vect1) || !is_array($vect2)) { trigger_error("Incorrect parameters, arrays expected", E_USER_ERROR); return NULL; } if (count($vect1) != count($vect2)) { trigger_error("Vectors need to be of the same size", E_USER_ERROR); return NULL; } for ($i=0; $i<count($vect1); $i++) { $c1 = $vect1[$i]; $c2 = $vect2[$i]; $d = 0.0; if (!is_numeric($c1)) { trigger_error("Coordinate $i in vector 1 is not a number, using zero", E_USER_WARNING); $c1 = 0.0; } if (!is_numeric($c2)) { trigger_error("Coordinate $i in vector 2 is not a number, using zero", E_USER_WARNING); $c2 = 0.0; } $d += $c2*$c2 - $c1*$c1; } } $old_error_handler = set_error_handler("userErrorHandler"); // variabile non definita, genera un warning $t = I_AM_NOT_DEFINED; // definisce dei vettori $a = array(2, 3, "foo"); $b = array(5.5, 4.3, -1.6); $c = array(1, -3); // genera un errore utente $t1 = distance($c, $b) . "\n"; // un'altro errore utente $t2 = distance($b, "i am not an array") . "\n"; // genera un warning $t3 = distance($a, $b) . "\n"; ?>

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.0120.00318.28
8.3.50.0100.00721.02
8.3.40.0030.01618.82
8.3.30.0160.00320.20
8.3.20.0070.00418.91
8.3.10.0040.01219.39
8.3.00.0040.00419.68
8.2.180.0180.00016.88
8.2.170.0120.00322.96
8.2.160.0070.00720.32
8.2.150.0080.00024.18
8.2.140.0050.00224.66
8.2.130.0040.00426.16
8.2.120.0000.00819.95
8.2.110.0070.00322.24
8.2.100.0090.00317.84
8.2.90.0060.00319.23
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0050.00317.93
8.2.50.0000.00918.07
8.2.40.0040.00419.95
8.2.30.0040.00421.21
8.2.20.0040.00417.62
8.2.10.0000.00817.82
8.2.00.0030.00717.75
8.1.270.0070.00023.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00622.05
8.1.230.0040.00717.52
8.1.220.0040.00417.77
8.1.210.0000.00818.77
8.1.200.0100.00017.38
8.1.190.0000.00817.53
8.1.180.0040.00418.10
8.1.170.0030.00518.64
8.1.160.0000.00718.96
8.1.150.0000.00918.54
8.1.140.0000.00717.47
8.1.130.0030.00317.85
8.1.120.0070.00317.50
8.1.110.0040.00417.38
8.1.100.0040.00417.47
8.1.90.0070.00017.50
8.1.80.0050.00317.39
8.1.70.0030.00317.50
8.1.60.0040.00417.52
8.1.50.0050.00317.40
8.1.40.0040.00417.44
8.1.30.0040.00417.63
8.1.20.0040.00417.61
8.1.10.0040.00417.64
8.1.00.0000.01117.55
8.0.300.0070.00018.77
8.0.290.0040.00416.75
8.0.280.0000.00718.43
8.0.270.0000.00717.19
8.0.260.0040.00416.98
8.0.250.0070.00017.06
8.0.240.0000.00817.03
8.0.230.0030.00317.02
8.0.220.0000.00716.97
8.0.210.0040.00416.98
8.0.200.0000.00616.93
8.0.190.0000.00716.93
8.0.180.0050.00216.94
8.0.170.0000.00716.87
8.0.160.0040.00416.91
8.0.150.0000.00817.01
8.0.140.0070.00016.95
8.0.130.0090.00013.45
8.0.120.0040.00416.82
8.0.110.0000.00816.78
8.0.100.0040.00416.86
8.0.90.0040.00417.04
8.0.80.0130.00316.90
8.0.70.0070.00016.88
8.0.60.0040.00416.85
8.0.50.0000.00716.94
8.0.30.0100.00917.39
8.0.20.0110.00817.40
8.0.10.0050.00216.98
8.0.00.0140.00816.90
7.4.330.0000.00516.77
7.4.320.0030.00316.64
7.4.300.0040.00416.56
7.4.290.0040.00416.52
7.4.280.0030.00316.59
7.4.270.0000.00816.54
7.4.260.0000.00513.18
7.4.250.0000.00816.43
7.4.240.0000.00816.59
7.4.230.0030.00316.73
7.4.220.0180.00316.68
7.4.210.0060.01116.59
7.4.200.0000.00716.64
7.4.190.0000.00816.41
7.4.160.0110.00616.52
7.4.150.0160.00317.40
7.4.140.0130.00817.86
7.4.130.0040.01616.51
7.4.120.0050.01216.60
7.4.110.0000.01816.70
7.4.100.0100.01016.34
7.4.90.0140.01016.48
7.4.80.0140.00919.39
7.4.70.0160.00616.52
7.4.60.0120.00416.46
7.4.50.0000.00816.57
7.4.40.0040.01122.77
7.4.30.0070.01016.67
7.4.10.0130.00714.90
7.4.00.0070.01014.89
7.3.330.0030.00313.40
7.3.320.0030.00313.56
7.3.310.0030.00316.51
7.3.300.0030.00316.27
7.3.290.0070.00716.34
7.3.280.0080.00816.49
7.3.270.0100.01317.40
7.3.260.0070.01318.24
7.3.250.0120.00816.51
7.3.240.0070.01016.68
7.3.230.0100.00716.45
7.3.210.0040.01516.47
7.3.200.0150.00919.39
7.3.190.0100.00916.46
7.3.180.0110.00716.60
7.3.170.0000.01616.52
7.3.160.0120.00416.66
7.3.130.0140.00314.95
7.3.120.0080.00514.73
7.3.110.0000.01714.96
7.3.100.0040.00815.05
7.3.90.0070.00315.09
7.3.80.0040.00715.03
7.3.70.0060.00914.59
7.3.60.0070.01014.86
7.3.50.0000.01514.97
7.3.40.0030.00914.98
7.3.30.0090.00615.07
7.3.20.0110.00316.78
7.3.10.0120.00616.55
7.3.00.0150.00516.64
7.2.330.0000.01816.70
7.2.320.0080.01216.57
7.2.310.0070.01116.59
7.2.300.0100.00716.83
7.2.290.0070.01016.62
7.2.260.0100.01015.10
7.2.250.0120.00315.34
7.2.240.0070.01115.07
7.2.230.0060.01015.19
7.2.220.0070.00315.02
7.2.210.0030.00915.10
7.2.200.0060.01215.14
7.2.190.0110.00415.05
7.2.180.0060.00614.86
7.2.170.0070.00714.92
7.2.160.0120.00314.85
7.2.150.0100.00616.95
7.2.140.0130.00316.85
7.2.130.0090.00816.66
7.2.120.0100.00916.43
7.2.110.0120.00616.71
7.2.100.0150.00416.73
7.2.90.0090.00716.80
7.2.80.0110.00616.74
7.2.70.0060.01316.78
7.2.60.0070.01116.87
7.2.50.0110.00616.74
7.2.40.0080.00716.96
7.2.30.0110.00716.74
7.2.20.0080.01016.78
7.2.10.0090.00916.59
7.2.00.0080.00917.47
7.1.330.0030.01016.02
7.1.320.0070.01015.62
7.1.310.0070.00715.71
7.1.300.0000.01515.78
7.1.290.0000.01315.91
7.1.280.0030.01015.95
7.1.270.0060.00315.61
7.1.260.0070.01015.89
7.1.250.0080.01315.52
7.1.240.0030.00715.70
7.1.230.0090.00615.83
7.1.220.0040.01115.82
7.1.210.0050.00515.82
7.1.200.0100.01115.70
7.1.190.0040.01115.63
7.1.180.0000.01415.92
7.1.170.0000.01115.63
7.1.160.0100.00715.78
7.1.150.0100.00315.97
7.1.140.0030.01015.91
7.1.130.0000.01316.02
7.1.120.0060.00915.97
7.1.110.0030.01215.67
7.1.100.0040.00617.06
7.1.90.0000.00915.94
7.1.80.0030.01215.95
7.1.70.0070.00716.55
7.1.60.0080.01217.63
7.1.50.0060.01016.38
7.1.40.0000.01315.84
7.1.30.0060.00615.93
7.1.20.0030.01315.75
7.1.10.0030.01215.77
7.1.00.0050.04319.00
7.0.330.0080.00415.52
7.0.320.0000.00915.21
7.0.310.0030.00915.36
7.0.300.0090.00615.28
7.0.290.0130.00315.46
7.0.280.0050.00515.37
7.0.270.0030.01015.34
7.0.260.0000.01615.49
7.0.250.0000.01315.46
7.0.240.0060.00615.65
7.0.230.0060.00615.60
7.0.220.0090.00015.56
7.0.210.0090.00615.60
7.0.200.0020.00916.19
7.0.190.0060.00915.46
7.0.180.0090.00315.19
7.0.170.0070.00715.50
7.0.160.0030.01015.47
7.0.150.0040.01415.46
7.0.140.0050.04218.71
7.0.130.0080.00415.43
7.0.120.0060.00615.16
7.0.110.0100.01015.45
7.0.100.0060.03117.75
7.0.90.0150.03317.73
7.0.80.0120.03817.72
7.0.70.0070.04017.80
7.0.60.0130.02017.74
7.0.50.0050.04717.96
7.0.40.0110.03316.84
7.0.30.0070.03916.77
7.0.20.0050.04616.69
7.0.10.0120.02516.90
7.0.00.0070.04316.59
5.6.400.0000.01314.29
5.6.390.0070.00614.08
5.6.380.0000.01414.58
5.6.370.0080.00414.18
5.6.360.0040.01114.25
5.6.350.0040.01114.36
5.6.340.0030.01014.76
5.6.330.0100.00714.62
5.6.320.0030.01014.30
5.6.310.0000.01114.51
5.6.300.0060.01314.78
5.6.290.0040.00814.26
5.6.280.0050.04217.81
5.6.270.0060.01014.48
5.6.260.0100.00714.65
5.6.250.0090.04617.61
5.6.240.0050.04117.50
5.6.230.0030.04817.58
5.6.220.0030.03217.61
5.6.210.0080.03817.41
5.6.200.0070.02717.60
5.6.190.0070.04317.69
5.6.180.0070.04317.66
5.6.170.0070.04517.69
5.6.160.0030.05017.70
5.6.150.0080.04517.93
5.6.140.0030.05117.82
5.6.130.0070.04817.81
5.6.120.0030.03717.86
5.6.110.0110.04117.84
5.6.100.0100.04217.86
5.6.90.0110.02517.75
5.6.80.0050.04517.42
5.6.70.0090.03417.40
5.6.60.0050.04317.35
5.6.50.0070.04617.52
5.6.40.0030.04517.28
5.6.30.0120.03717.14
5.6.20.0100.04317.37
5.6.10.0050.04717.37
5.6.00.0120.04017.34
5.5.380.0080.04017.44
5.5.370.0050.04617.61
5.5.360.0080.04117.48
5.5.350.0080.03817.46
5.5.340.0100.04017.58
5.5.330.0090.04417.67
5.5.320.0110.04217.79
5.5.310.0070.04417.55
5.5.300.0080.04217.71
5.5.290.0080.04517.62
5.5.280.0100.04517.67
5.5.270.0130.04017.73
5.5.260.0050.04517.56
5.5.250.0130.04017.47
5.5.240.0070.04217.35
5.5.230.0030.04117.19
5.5.220.0060.04517.38
5.5.210.0090.02617.25
5.5.200.0070.04317.08
5.5.190.0070.04317.19
5.5.180.0050.04317.06
5.5.170.0080.00314.35
5.5.160.0030.03317.16
5.5.150.0040.04417.30
5.5.140.0110.03617.36
5.5.130.0050.04117.20
5.5.120.0050.04117.19
5.5.110.0120.03717.17
5.5.100.0140.03317.17
5.5.90.0100.03617.13
5.5.80.0120.03317.20
5.5.70.0070.04017.20
5.5.60.0110.02817.07
5.5.50.0100.04017.17
5.5.40.0120.04117.05
5.5.30.0060.04417.11
5.5.20.0100.02617.08
5.5.10.0080.03817.14
5.5.00.0120.03516.93
5.4.450.0050.04715.73
5.4.440.0020.04515.86
5.4.430.0060.04115.75
5.4.420.0050.02715.77
5.4.410.0080.03815.70
5.4.400.0030.04215.75
5.4.390.0100.04015.65
5.4.380.0030.02315.65
5.4.370.0020.02815.75
5.4.360.0100.03615.65
5.4.350.0050.04115.65
5.4.340.0050.04315.65
5.4.330.0030.00312.26
5.4.320.0050.04515.57
5.4.310.0030.04015.61
5.4.300.0050.03815.65
5.4.290.0050.02715.68
5.4.280.0120.03615.63
5.4.270.0030.03515.65
5.4.260.0050.04015.71
5.4.250.0090.03515.71
5.4.240.0020.03715.69
5.4.230.0070.03715.68
5.4.220.0100.03515.56
5.4.210.0070.03915.55
5.4.200.0070.04415.64
5.4.190.0100.03315.64
5.4.180.0070.04215.70
5.4.170.0050.02615.58
5.4.160.0030.04515.67
5.4.150.0030.02715.64
5.4.140.0060.01914.36
5.4.130.0050.04014.37
5.4.120.0030.02614.36
5.4.110.0050.04514.35
5.4.100.0100.03514.35
5.4.90.0100.03314.41
5.4.80.0080.03514.40
5.4.70.0030.04214.40
5.4.60.0050.03014.29
5.4.50.0050.01814.38
5.4.40.0070.03714.40
5.4.30.0050.04114.36
5.4.20.0020.03614.36
5.4.10.0020.03814.29
5.4.00.0100.03714.09
5.3.290.0100.03213.52
5.3.280.0070.04013.46
5.3.270.0050.03313.45
5.3.260.0090.02313.43
5.3.250.0040.03913.46
5.3.240.0090.03413.41
5.3.230.0030.03913.42
5.3.220.0060.03813.48
5.3.210.0030.04313.48
5.3.200.0150.01413.48
5.3.190.0060.03613.42
5.3.180.0080.03513.43
5.3.170.0070.04113.46
5.3.160.0020.02813.47
5.3.150.0030.02513.39
5.3.140.0050.02713.49
5.3.130.0050.03713.42
5.3.120.0070.03513.41
5.3.110.0080.03513.40
5.3.100.0080.03513.13
5.3.90.0030.04213.19
5.3.80.0020.04013.12
5.3.70.0080.03213.21
5.3.60.0090.03013.19
5.3.50.0100.03213.12
5.3.40.0080.02913.09
5.3.30.0030.03413.13
5.3.20.0070.04012.94
5.3.10.0070.03813.03
5.3.00.0060.04112.96
5.2.170.0170.05311.19
5.2.160.0070.03311.24
5.2.150.0030.06011.29
5.2.140.0000.05311.10
5.2.130.0030.03711.13
5.2.120.0100.05711.03
5.2.110.0070.06011.20
5.2.100.0070.06011.23
5.2.90.0030.06711.25
5.2.80.0070.06311.19
5.2.70.0070.06011.05
5.2.60.0170.05711.12
5.2.50.0100.05311.07
5.2.40.0030.06310.95
5.2.30.0030.03711.08
5.2.20.0100.02711.02
5.2.10.0100.02711.03
5.2.00.0070.03310.84
5.1.60.0070.05010.14
5.1.50.0030.03310.16
5.1.40.0030.05310.03
5.1.30.0030.05710.37
5.1.20.0070.06710.35
5.1.10.0130.03010.12
5.1.00.0100.04010.22
5.0.50.0000.0508.66
5.0.40.0030.0338.52
5.0.30.0070.0638.28
5.0.20.0030.0438.13
5.0.10.0000.0478.29
5.0.00.0100.0378.31
4.4.90.0070.0308.12
4.4.80.0070.0308.12
4.4.70.0030.0338.12
4.4.60.0000.0338.12
4.4.50.0030.0378.12
4.4.40.0030.0438.12
4.4.30.0000.0408.12
4.4.20.0000.0378.12
4.4.10.0070.0278.12
4.4.00.0030.0338.12
4.3.110.0030.0338.12
4.3.100.0000.0278.12
4.3.90.0070.0308.12
4.3.80.0000.0508.12
4.3.70.0070.0178.12
4.3.60.0000.0378.12
4.3.50.0000.0308.12
4.3.40.0070.0508.12
4.3.30.0000.0378.12
4.3.20.0000.0378.12
4.3.10.0000.0378.12
4.3.00.0030.0338.12

preferences:
53.41 ms | 400 KiB | 5 Q