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(); 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.0090.00618.93
8.3.50.0160.00821.21
8.3.40.0120.00418.96
8.3.30.0030.01020.59
8.3.20.0050.00220.46
8.3.10.0040.00422.30
8.3.00.0040.00422.62
8.2.180.0170.00317.00
8.2.170.0150.00322.96
8.2.160.0070.00722.20
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0080.00021.09
8.2.110.0040.00722.50
8.2.100.0000.01218.16
8.2.90.0030.00819.09
8.2.80.0030.00619.34
8.2.70.0050.00318.00
8.2.60.0000.00818.29
8.2.50.0090.00018.07
8.2.40.0050.00318.46
8.2.30.0000.00819.65
8.2.20.0060.00318.04
8.2.10.0040.00418.00
8.2.00.0040.00418.09
8.1.280.0070.01025.92
8.1.270.0060.00323.99
8.1.260.0060.01226.35
8.1.250.0000.00828.09
8.1.240.0090.00322.14
8.1.230.0100.00324.01
8.1.220.0040.00417.80
8.1.210.0050.00318.77
8.1.200.0090.00017.60
8.1.190.0000.00817.78
8.1.180.0040.00418.10
8.1.170.0000.00818.60
8.1.160.0000.00819.04
8.1.150.0050.00218.85
8.1.140.0030.00517.65
8.1.130.0030.00517.96
8.1.120.0000.00817.67
8.1.110.0060.00317.63
8.1.100.0050.00317.64
8.1.90.0040.00417.69
8.1.80.0030.00317.71
8.1.70.0030.00317.67
8.1.60.0030.00617.71
8.1.50.0040.00417.63
8.1.40.0110.00017.74
8.1.30.0040.00417.79
8.1.20.0040.00417.70
8.1.10.0040.00417.79
8.1.00.0080.00017.74
8.0.300.0000.00718.77
8.0.290.0040.00417.29
8.0.280.0030.00318.59
8.0.270.0070.00017.02
8.0.260.0000.00717.09
8.0.250.0030.00317.14
8.0.240.0080.00417.15
8.0.230.0040.00417.15
8.0.220.0070.00017.19
8.0.210.0020.00517.13
8.0.200.0030.00317.25
8.0.190.0000.00717.28
8.0.180.0050.00317.20
8.0.170.0000.00817.10
8.0.160.0000.00817.04
8.0.150.0070.00017.02
8.0.140.0000.00917.11
8.0.130.0060.00013.60
8.0.120.0030.00517.09
8.0.110.0030.00517.15
8.0.100.0040.00417.09
8.0.90.0040.00417.11
8.0.80.0130.00717.01
8.0.70.0040.00417.14
8.0.60.0000.00817.18
8.0.50.0000.00717.08
8.0.30.0080.01317.17
8.0.20.0080.01017.40
8.0.10.0000.00717.20
8.0.00.0100.01016.91
7.4.330.0000.00617.02
7.4.320.0030.00516.74
7.4.300.0030.00316.73
7.4.290.0070.00016.77
7.4.280.0030.00316.79
7.4.270.0000.00716.66
7.4.260.0000.00513.63
7.4.250.0000.00816.88
7.4.240.0050.00316.77
7.4.230.0080.00016.97
7.4.220.0200.00016.68
7.4.210.0080.00716.69
7.4.200.0000.00716.89
7.4.190.0030.00316.95
7.4.160.0110.00816.89
7.4.150.0130.00617.40
7.4.140.0130.00517.86
7.4.130.0090.00916.76
7.4.120.0080.01016.71
7.4.110.0130.00316.66
7.4.100.0140.00316.71
7.4.90.0180.00016.76
7.4.80.0090.01019.39
7.4.70.0070.01116.73
7.4.60.0140.00316.53
7.4.50.0020.00216.67
7.4.40.0100.00622.77
7.4.30.0160.00616.53
7.4.00.0090.00815.43
7.3.330.0050.00013.52
7.3.320.0000.00613.72
7.3.310.0050.00316.55
7.3.300.0070.00016.65
7.3.290.0080.00616.57
7.3.280.0070.01116.53
7.3.270.0000.02017.40
7.3.260.0220.02018.24
7.3.250.0050.01516.69
7.3.240.0090.01416.67
7.3.230.0110.00816.58
7.3.210.0070.01016.59
7.3.200.0070.01119.39
7.3.190.0130.01216.67
7.3.180.0060.00916.44
7.3.170.0090.00916.79
7.3.160.0080.00816.47
7.3.120.0120.00515.13
7.3.110.0030.01414.92
7.3.100.0120.00615.22
7.3.90.0100.00715.11
7.3.80.0030.01315.11
7.3.70.0040.00915.16
7.3.60.0040.01115.10
7.3.50.0060.01014.82
7.3.40.0130.00015.04
7.3.30.0100.00715.26
7.3.20.0100.00317.04
7.3.10.0130.00316.98
7.3.00.0070.01016.96
7.2.330.0100.00916.77
7.2.320.0120.00616.74
7.2.310.0070.01716.75
7.2.300.0120.00616.92
7.2.290.0100.00716.77
7.2.250.0110.00815.64
7.2.240.0040.01415.59
7.2.230.0040.01115.64
7.2.220.0090.00615.55
7.2.210.0000.01115.41
7.2.200.0080.00815.45
7.2.190.0060.00615.57
7.2.180.0000.01015.52
7.2.170.0100.00715.44
7.2.110.0240.00617.02
7.2.60.0110.00417.14
7.2.00.0030.01019.32
7.1.330.0080.00616.37
7.1.320.0060.00915.93
7.1.310.0100.00316.18
7.1.300.0000.01416.13
7.1.290.0030.01016.07
7.1.280.0000.01115.88
7.1.270.0070.01016.13
7.1.260.0070.00716.34
7.1.200.0070.00716.13
7.1.100.0070.00418.41
7.1.70.0040.00417.42
7.1.60.0090.01519.17
7.1.50.0100.01017.12
7.1.00.0000.06022.73
7.0.200.0050.00216.80
7.0.140.0130.06722.29
7.0.60.0170.07320.47
7.0.50.0000.07018.37
7.0.40.0200.03020.58
7.0.30.0230.05320.39
7.0.20.0200.04720.60
7.0.10.0200.05020.68
7.0.00.0130.08020.54
5.6.280.0070.07321.21
5.6.210.0230.07020.95
5.6.200.0070.04018.54
5.6.190.0100.05720.89
5.6.180.3430.03720.93
5.6.170.0400.07720.94
5.6.160.0070.04020.96
5.6.150.0030.04018.62
5.6.140.0130.06018.46
5.6.130.0070.03718.65
5.6.120.0000.04321.46
5.6.110.0070.09021.38
5.6.100.0070.04021.45
5.6.90.0130.07721.43
5.6.80.0070.05720.87
5.6.70.0130.03320.81
5.5.350.0170.08320.82
5.5.340.0100.06018.40
5.5.330.0030.06720.63
5.5.320.0230.05320.65
5.5.310.0330.07320.56
5.5.300.0070.08318.31
5.5.290.0100.06318.36
5.5.280.0070.08721.34
5.5.270.0000.04321.36
5.5.260.0130.07721.24
5.5.250.0030.04321.10
5.5.240.0130.07720.68
5.4.450.0100.06319.71
5.4.440.0030.04319.93
5.4.430.0070.06719.88
5.4.420.0070.08019.62
5.4.410.0100.06319.66
5.4.400.0100.07319.54
5.4.390.0030.06319.63
5.4.380.0000.08319.38
5.4.370.0100.08019.45
5.4.360.0330.03719.46
5.4.350.0170.06019.54
5.4.340.0230.06019.46
5.4.320.0130.06719.25
5.4.310.0130.04319.40
5.4.300.0330.06719.22
5.4.290.0270.05719.37
5.4.280.0330.05719.55
5.4.270.0100.04019.58
5.4.260.0100.07319.46
5.4.250.0030.08019.55
5.4.240.0130.06719.44
5.4.230.0030.06719.29
5.4.220.0030.08719.18
5.4.210.0100.07019.32
5.4.200.0170.08319.40
5.4.190.0330.06319.54
5.4.180.0200.07319.55
5.4.170.0130.07019.31
5.4.160.0170.07319.61
5.4.150.0200.08019.67
5.4.140.0130.08016.88
5.4.130.0330.06016.71
5.4.120.0270.05717.02
5.4.110.0200.07716.77
5.4.100.0270.06716.96
5.4.90.0200.07016.61
5.4.80.0200.05016.75
5.4.70.0230.05716.80
5.4.60.0200.06716.70
5.4.50.0270.06316.80
5.4.40.0230.03016.70
5.4.30.0270.06316.79
5.4.20.0170.07716.97
5.4.10.0170.06716.79
5.4.00.0170.07316.34
5.3.290.0130.06314.95
5.3.280.0030.07715.00
5.3.270.0170.06315.00
5.3.260.0300.06014.93
5.3.250.0100.08314.93
5.3.240.0230.07014.98
5.3.230.0270.05714.89
5.3.220.0400.03714.87
5.3.210.0230.07314.98
5.3.200.0200.04714.97
5.3.190.0200.04015.00
5.3.180.0230.06315.00
5.3.170.0200.06014.96
5.3.160.0130.07314.95
5.3.150.0130.04014.89
5.3.140.0200.05014.92
5.3.130.0130.05714.83
5.3.120.0270.06715.09
5.3.110.0200.05314.92
5.3.100.0170.03714.52
5.3.90.0270.04014.57
5.3.80.0200.04314.58
5.3.70.0200.07014.27
5.3.60.0130.06014.29
5.3.50.0200.03014.43
5.3.40.0230.04714.24
5.3.30.0230.06314.22
5.3.20.0300.06314.06
5.3.10.0230.06714.02
5.3.00.0270.04713.89
5.2.170.0130.06312.61
5.2.160.0070.04712.61
5.2.150.0100.03712.61
5.2.140.0070.03312.61
5.2.130.0170.03312.61
5.2.120.0170.06012.64
5.2.110.0170.03012.68
5.2.100.0230.05012.68
5.2.90.0230.04012.68
5.2.80.0170.06012.68
5.2.70.0200.06012.68
5.2.60.0100.04712.68
5.2.50.0030.05712.68
5.2.40.0030.03712.68
5.2.30.0030.06312.68
5.2.20.0070.03012.68
5.2.10.0030.06012.68
5.2.00.0030.06312.68
5.1.60.0030.05312.68
5.1.50.0030.05712.68
5.1.40.0100.04012.68
5.1.30.0000.04012.68
5.1.20.0030.05712.68
5.1.10.0030.05712.68
5.1.00.0070.04312.68
5.0.50.0030.02312.68
5.0.40.0030.02312.68
5.0.30.0070.04312.68
5.0.20.0000.02712.68
5.0.10.0100.02312.68
5.0.00.0000.06712.68
4.4.90.0030.04012.68
4.4.80.0030.03312.68
4.4.70.0000.02012.68
4.4.60.0000.03312.68
4.4.50.0030.03312.68
4.4.40.0070.05012.68
4.4.30.0030.03312.68
4.4.20.0030.03312.68
4.4.10.0000.02012.68
4.4.00.0030.05312.68
4.3.110.0030.03312.68
4.3.100.0030.03312.68
4.3.90.0030.03312.68
4.3.80.0000.03312.68
4.3.70.0030.02312.68
4.3.60.0030.01712.68
4.3.50.0170.02712.68
4.3.40.0000.05012.68
4.3.30.0000.02712.68
4.3.20.0000.03712.68
4.3.10.0070.01712.68
4.3.00.0030.01712.68

preferences:
67.3 ms | 401 KiB | 5 Q