3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(); // ridefinisce la costante dell'errore utente - solo PHP 4 define (FATAL,E_USER_ERROR); define (ERROR,E_USER_WARNING); define (WARNING,E_USER_NOTICE); // configura il livello di restituzione errore per questo script error_reporting (FATAL | ERROR | WARNING); // 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"; 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.70.0090.00916.58
8.3.60.0060.01518.43
8.3.50.0130.00621.09
8.3.40.0160.00318.87
8.3.30.0070.01020.13
8.3.20.0030.00518.85
8.3.10.0000.00820.87
8.3.00.0090.00019.68
8.2.180.0070.01317.00
8.2.170.0100.00722.96
8.2.160.0100.00320.47
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0040.00419.76
8.2.110.0060.00319.21
8.2.100.0000.01217.69
8.2.90.0040.00419.21
8.2.80.0040.00419.21
8.2.70.0050.00317.75
8.2.60.0040.00418.03
8.2.50.0040.00418.07
8.2.40.0080.00019.88
8.2.30.0050.00219.48
8.2.20.0030.00617.73
8.2.10.0040.00417.82
8.2.00.0000.01117.74
8.1.280.0110.01125.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0030.00820.56
8.1.230.0060.00620.99
8.1.220.0050.00318.77
8.1.210.0000.00818.90
8.1.200.0060.00317.22
8.1.190.0000.00817.29
8.1.180.0030.00618.10
8.1.170.0080.00018.53
8.1.160.0030.00518.73
8.1.150.0040.00418.59
8.1.140.0080.00017.32
8.1.130.0030.00317.69
8.1.120.0000.00917.32
8.1.110.0040.00417.30
8.1.100.0070.00017.44
8.1.90.0000.00717.45
8.1.80.0040.00417.39
8.1.70.0030.00317.38
8.1.60.0000.00917.43
8.1.50.0040.00417.49
8.1.40.0080.00017.45
8.1.30.0000.00817.51
8.1.20.0090.00017.63
8.1.10.0050.00217.57
8.1.00.0000.01117.35
8.0.300.0040.00419.84
8.0.290.0060.00317.28
8.0.280.0000.00718.46
8.0.270.0000.00717.32
8.0.260.0070.00016.88
8.0.250.0070.00017.02
8.0.240.0000.00817.00
8.0.230.0040.00417.03
8.0.220.0070.00016.86
8.0.210.0070.00016.92
8.0.200.0060.00016.95
8.0.190.0000.00717.05
8.0.180.0080.00017.01
8.0.170.0040.00416.82
8.0.160.0000.00716.86
8.0.150.0000.00816.99
8.0.140.0070.00016.91
8.0.130.0000.00813.39
8.0.120.0080.00016.86
8.0.110.0000.00717.03
8.0.100.0000.00717.01
8.0.90.0000.00716.82
8.0.80.0120.00416.90
8.0.70.0040.00416.94
8.0.60.0050.00216.93
8.0.50.0050.00316.85
8.0.30.0110.01117.08
8.0.20.0140.00417.40
8.0.10.0000.00716.98
8.0.00.0040.01316.73
7.4.330.0000.00517.06
7.4.320.0070.00016.86
7.4.300.0040.00416.77
7.4.290.0070.00016.79
7.4.280.0000.00816.79
7.4.270.0030.00316.77
7.4.260.0000.00513.59
7.4.250.0000.00716.71
7.4.240.0000.00716.66
7.4.230.0050.00216.84
7.4.220.0150.00316.71
7.4.210.0100.00616.70
7.4.200.0040.00416.52
7.4.190.0050.00216.66
7.4.160.0090.00916.73
7.4.150.0130.00617.40
7.4.140.0170.00517.86
7.4.130.0120.00916.81
7.4.120.0150.00516.79
7.4.110.0090.01016.68
7.4.100.0120.00916.50
7.4.90.0140.00616.70
7.4.80.0070.01119.39
7.4.70.0070.01016.69
7.4.60.0110.00616.56
7.4.50.0030.00516.62
7.4.40.0070.00722.77
7.4.30.0110.01116.68
7.4.00.0050.00915.32
7.3.330.0050.00013.69
7.3.320.0030.00313.69
7.3.310.0070.00016.55
7.3.300.0000.00716.55
7.3.290.0090.00616.62
7.3.280.0100.00716.58
7.3.270.0140.00317.40
7.3.260.0060.01418.24
7.3.250.0130.00716.53
7.3.240.0040.01416.66
7.3.230.0070.01116.76
7.3.210.0060.01016.70
7.3.200.0220.00019.39
7.3.190.0090.01216.80
7.3.180.0070.01016.55
7.3.170.0030.01316.67
7.3.160.0060.01616.80
7.3.120.0030.01415.12
7.3.110.0090.00915.43
7.3.100.0100.01015.05
7.3.90.0140.00015.34
7.3.80.0090.00615.32
7.3.70.0040.00715.18
7.3.60.0060.00915.24
7.3.50.0070.00715.20
7.3.40.0060.01015.01
7.3.30.0000.01015.05
7.3.20.0100.00316.72
7.3.10.0000.01416.96
7.3.00.0090.00617.04
7.2.330.0100.01016.60
7.2.320.0100.01016.60
7.2.310.0120.00817.06
7.2.300.0160.00016.90
7.2.290.0030.01416.69
7.2.250.0110.00815.56
7.2.240.0110.00715.68
7.2.230.0060.01015.04
7.2.220.0080.00815.33
7.2.210.0140.00315.28
7.2.200.0070.00715.48
7.2.190.0000.01815.43
7.2.180.0120.00315.55
7.2.170.0100.00615.19
7.2.160.0000.01315.24
7.2.150.0040.00917.10
7.2.140.0090.00617.41
7.2.130.0070.01117.27
7.2.120.0030.01317.33
7.2.110.0060.00317.19
7.2.100.0080.00817.08
7.2.90.0070.00417.13
7.2.80.0050.00517.40
7.2.70.0040.01517.41
7.2.60.0020.01417.21
7.2.50.0070.00716.87
7.2.40.0070.00717.29
7.2.30.0060.00617.25
7.2.20.0070.01117.34
7.2.10.0090.00317.17
7.2.00.0020.01218.35
7.1.330.0030.01315.96
7.1.320.0030.01315.89
7.1.310.0000.01115.97
7.1.300.0090.00616.24
7.1.290.0040.00416.06
7.1.280.0040.00816.07
7.1.270.0090.00316.15
7.1.260.0110.00416.01
7.1.250.0120.00616.05
7.1.240.0090.00316.23
7.1.230.0000.00916.19
7.1.220.0070.01016.27
7.1.210.0040.00816.15
7.1.200.0060.00615.95
7.1.190.0070.01015.87
7.1.180.0070.00716.05
7.1.170.0000.00816.24
7.1.160.0090.00616.17
7.1.150.0040.00716.03
7.1.140.0040.00416.00
7.1.130.0030.01015.85
7.1.120.0030.01016.10
7.1.110.0030.01016.20
7.1.100.0060.00915.83
7.1.90.0100.00716.11
7.1.80.0060.00616.22
7.1.70.0010.00816.71
7.1.60.0050.01016.90
7.1.50.0060.00816.69
7.1.40.0050.00716.45
7.1.30.0060.01116.64
7.1.20.0060.00616.56
7.1.10.0050.00916.54
7.1.00.0020.00816.48
7.0.330.0070.01015.59
7.0.320.0090.00615.96
7.0.310.0060.00315.81
7.0.300.0030.00915.90
7.0.290.0060.00615.66
7.0.280.0090.00615.91
7.0.270.0060.00615.77
7.0.260.0040.00915.70
7.0.250.0140.00015.76
7.0.240.0000.01315.89
7.0.230.0030.00715.49
7.0.220.0060.00915.61
7.0.210.0000.01715.74
7.0.200.0050.00816.46
7.0.190.0040.00716.33
7.0.180.0010.01016.17
7.0.170.0040.00916.35
7.0.160.0030.00716.38
7.0.150.0000.00816.22
7.0.140.0030.00716.23
7.0.130.0050.00516.39
7.0.120.0060.00316.28
7.0.110.0020.01016.25
7.0.100.0020.00616.28
7.0.90.0030.00816.12
7.0.80.0020.00816.19
7.0.70.0030.00816.17
7.0.60.0070.00516.01
7.0.50.0020.00816.43
7.0.40.0060.00614.45
7.0.30.0050.00914.51
7.0.20.0070.00414.42
7.0.10.0060.00314.38
7.0.00.0010.01014.42
5.6.400.0030.01214.25
5.6.390.0100.00914.79
5.6.380.0030.00914.93
5.6.370.0000.01914.77
5.6.360.0040.00814.90
5.6.350.0060.00314.69
5.6.340.0060.00914.88
5.6.330.0070.00714.70
5.6.320.0060.01014.79
5.6.310.0070.01114.70
5.6.300.0030.03118.05
5.6.290.0030.02717.75
5.6.280.0070.02517.67
5.6.270.0030.02418.03
5.6.260.0030.03917.79
5.6.250.0030.02418.05
5.6.240.0030.02817.75
5.6.230.0040.02317.92
5.6.220.0090.02017.91
5.6.210.0090.02118.02
5.6.200.0030.02918.01
5.6.190.0080.02418.03
5.6.180.0040.02718.00
5.6.170.0100.02317.86
5.6.160.0000.03117.85
5.6.150.0120.04217.95
5.6.140.0100.02117.87
5.6.130.0020.02917.85
5.6.120.0020.02817.79
5.6.110.0020.03517.81
5.6.100.0030.04518.05
5.6.90.0050.04217.91
5.6.80.0060.02317.76
5.6.70.0080.01917.55
5.6.60.0030.02617.54
5.6.50.0030.02417.63
5.6.40.0050.03017.57
5.6.30.0050.03217.36
5.6.20.0050.02717.73
5.6.10.0100.02817.61
5.6.00.0050.02117.57
5.5.380.0060.02616.17
5.5.370.0050.02116.27
5.5.360.0030.03616.21
5.5.350.0080.04116.29
5.5.340.0050.02416.21
5.5.330.0030.02516.50
5.5.320.0050.02416.59
5.5.310.0030.02316.70
5.5.300.0050.02316.45
5.5.290.0020.03016.43
5.5.280.0050.02316.55
5.5.270.0040.03016.44
5.5.260.0150.02716.56
5.5.250.0090.01916.21
5.5.240.0060.03316.05
5.5.230.0050.02416.00
5.5.220.0050.02115.96
5.5.210.0040.02516.04
5.5.200.0050.02116.17
5.5.190.0050.02216.17
5.5.180.0100.01615.84
5.5.170.0030.00614.79
5.5.160.0080.02216.06
5.5.150.0050.02316.18
5.5.140.0050.02615.74
5.5.130.0030.02916.11
5.5.120.0050.02616.12
5.5.110.0050.02516.09
5.5.100.0000.03016.07
5.5.90.0050.02116.26
5.5.80.0050.03716.16
5.5.70.0070.02216.02
5.5.60.0060.01915.83
5.5.50.0050.02216.00
5.5.40.0020.02616.03
5.5.30.0120.02615.91
5.5.20.0060.02715.77
5.5.10.0030.03016.02
5.5.00.0070.02115.91
5.4.450.0070.02516.04
5.4.440.0020.02616.00
5.4.430.0050.02716.15
5.4.420.0000.02616.06
5.4.410.0080.03315.93
5.4.400.0040.02515.80
5.4.390.0020.02415.97
5.4.380.0050.02215.99
5.4.370.0060.01915.88
5.4.360.0020.02515.85
5.4.350.0030.02415.88
5.4.340.0120.02115.85
5.4.330.0060.00612.48
5.4.320.0020.02315.88
5.4.310.0030.02315.98
5.4.300.0050.02215.97
5.4.290.0030.02115.87
5.4.280.0050.02316.00
5.4.270.0040.03315.80
5.4.260.0030.02715.88
5.4.250.0150.02915.85
5.4.240.0010.03215.84
5.4.230.0060.02115.89
5.4.220.0000.02515.85
5.4.210.0080.03415.85
5.4.200.0000.02815.76
5.4.190.0070.01915.89
5.4.180.0090.01815.88
5.4.170.0050.02215.84
5.4.160.0050.02515.79
5.4.150.0080.01715.79
5.4.140.0000.02614.59
5.4.130.0030.02314.75
5.4.120.0000.03214.68
5.4.110.0050.02414.69
5.4.100.0060.03514.77
5.4.90.0030.02114.68
5.4.80.0030.03714.65
5.4.70.0060.02114.68
5.4.60.0070.01914.73
5.4.50.0050.02114.73
5.4.40.0080.01714.62
5.4.30.0040.02114.67
5.4.20.0050.02314.74
5.4.10.0050.01914.56
5.4.00.0080.03614.50
5.3.290.0050.03213.82
5.3.280.0020.02613.84
5.3.270.0060.02413.82
5.3.260.0030.02413.82
5.3.250.0030.02213.82
5.3.240.0050.02113.84
5.3.230.0080.02213.82
5.3.220.0040.02313.82
5.3.210.0000.02413.84
5.3.200.0080.01813.83
5.3.190.0030.02413.82
5.3.180.0050.02213.82
5.3.170.0030.02513.84
5.3.160.0130.02613.82
5.3.150.0050.02313.82
5.3.140.0030.02213.82
5.3.130.0050.03213.82
5.3.120.0050.02013.82
5.3.110.0060.02413.82
5.3.100.0110.02313.82
5.3.90.0050.02313.82
5.3.80.0060.01913.82
5.3.70.0030.02213.82
5.3.60.0040.01913.82
5.3.50.0030.02113.82
5.3.40.0070.02213.82
5.3.30.0000.02613.82
5.3.20.0020.02213.82
5.3.10.0060.02013.82
5.3.00.0050.03913.82
5.2.170.0070.02415.16
5.2.160.0040.03215.16
5.2.150.0100.03415.16
5.2.140.0070.02715.16
5.2.130.0060.02415.16
5.2.120.0030.03015.16
5.2.110.0030.02715.16
5.2.100.0000.04015.16
5.2.90.0030.04215.16
5.2.80.0040.03615.16
5.2.70.0040.03015.16
5.2.60.0030.02915.16
5.2.50.0000.04215.16
5.2.40.0000.03215.16
5.2.30.0060.02615.16
5.2.20.0060.02715.16
5.2.10.0030.03815.16
5.2.00.0060.02515.16
5.1.60.0000.02815.16
5.1.50.0000.04415.16
5.1.40.0070.02315.16
5.1.30.0030.02715.16
5.1.20.0030.02615.16
5.1.10.0030.02515.16
5.1.00.0030.02815.16
5.0.50.0000.02915.16
5.0.40.0000.03015.16
5.0.30.0070.05315.16
5.0.20.0000.03815.16
5.0.10.0000.02215.16
5.0.00.0070.03315.16
4.4.90.0000.01815.16
4.4.80.0030.01815.16
4.4.70.0000.02115.16
4.4.60.0090.00915.16
4.4.50.0000.01915.16
4.4.40.0090.02215.16
4.4.30.0000.01815.16
4.4.20.0030.01415.16
4.4.10.0030.01715.16
4.4.00.0040.02215.16
4.3.110.0080.00815.16
4.3.100.0060.04015.16
4.3.90.0000.01715.16
4.3.80.0060.02215.16
4.3.70.0000.01815.16
4.3.60.0000.01715.16
4.3.50.0090.01915.16
4.3.40.0030.02515.16
4.3.30.0060.01415.16
4.3.20.0000.01715.16
4.3.10.0060.01215.16
4.3.00.0000.03015.16

preferences:
31.9 ms | 401 KiB | 5 Q