3v4l.org

run code in 300+ PHP versions simultaneously
<?php function distance($vect1, $vect2) { if (!is_array($vect1) || !is_array($vect2)) { return NULL; } if (count($vect1) != count($vect2)) { 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; return $d; echo sqrt($d); } } // variabile non definita, genera un warning // definisce dei vettori $b = array(5.5, 4.3); $c = array(1, 3); // genera un errore utente var_dump(distance($c, $b)) ; // un'altro errore utente var_dump(distance($b, "i am not an array")) ; // genera un warning ?>

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.00818.39
8.3.50.0260.00522.05
8.3.40.0150.00718.65
8.3.30.0000.01720.20
8.3.20.0000.00918.88
8.3.10.0080.00021.13
8.3.00.0030.00619.79
8.2.180.0190.00316.48
8.2.170.0070.00722.96
8.2.160.0070.00720.57
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0050.00319.95
8.2.110.0030.00619.21
8.2.100.0080.00417.78
8.2.90.0000.00919.20
8.2.80.0040.00419.25
8.2.70.0050.00317.75
8.2.60.0000.00918.04
8.2.50.0060.00318.07
8.2.40.0030.00619.88
8.2.30.0040.00421.14
8.2.20.0020.00517.61
8.2.10.0070.00017.70
8.2.00.0060.00617.64
8.1.280.0090.00925.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0090.00420.64
8.1.230.0040.00721.04
8.1.220.0080.00018.77
8.1.210.0050.00318.91
8.1.200.0080.00517.13
8.1.190.0000.00817.53
8.1.180.0080.00018.10
8.1.170.0050.00318.50
8.1.160.0000.00719.00
8.1.150.0040.00418.65
8.1.140.0040.00417.46
8.1.130.0000.00717.84
8.1.120.0070.00417.46
8.1.110.0000.00717.53
8.1.100.0040.00417.37
8.1.90.0070.00017.52
8.1.80.0000.00717.46
8.1.70.0070.00017.44
8.1.60.0030.00617.60
8.1.50.0000.00717.48
8.1.40.0040.00417.52
8.1.30.0050.00317.57
8.1.20.0040.00417.58
8.1.10.0000.00717.52
8.1.00.0060.00317.50
8.0.300.0050.00319.89
8.0.290.0040.00417.05
8.0.280.0040.00418.41
8.0.270.0050.00317.17
8.0.260.0030.00316.88
8.0.250.0090.00016.99
8.0.240.0000.00816.96
8.0.230.0030.00316.94
8.0.220.0070.00016.90
8.0.210.0070.00017.00
8.0.200.0000.00716.91
8.0.190.0030.00316.97
8.0.180.0000.00716.96
8.0.170.0040.00416.89
8.0.160.0070.00016.83
8.0.150.0070.00016.78
8.0.140.0040.00416.89
8.0.130.0050.00313.27
8.0.120.0030.00516.76
8.0.110.0000.00716.92
8.0.100.0040.00416.82
8.0.90.0040.00416.78
8.0.80.0110.01016.93
8.0.70.0040.00416.88
8.0.60.0070.00016.75
8.0.50.0000.00816.93
8.0.30.0100.00817.19
8.0.20.0150.00717.40
8.0.10.0040.00416.97
8.0.00.0090.00916.74
7.4.330.0060.00016.71
7.4.320.0030.00316.41
7.4.300.0050.00516.61
7.4.290.0000.00716.50
7.4.280.0000.00816.55
7.4.270.0000.00716.60
7.4.260.0000.00513.30
7.4.250.0040.00416.62
7.4.240.0000.00716.66
7.4.230.0030.00316.68
7.4.220.0030.01616.52
7.4.210.0060.01016.56
7.4.200.0050.00216.32
7.4.190.0000.00716.76
7.4.160.0110.00416.58
7.4.150.0110.00717.40
7.4.140.0170.00317.86
7.4.130.0120.00816.45
7.4.120.0080.00916.53
7.4.110.0110.00716.61
7.4.100.0030.01416.58
7.4.90.0060.01216.47
7.4.80.0120.01219.39
7.4.70.0070.01016.74
7.4.60.0000.01716.45
7.4.50.0000.00816.46
7.4.40.0060.00922.77
7.4.30.0060.01216.66
7.4.00.0070.01014.79
7.3.330.0000.00513.09
7.3.320.0000.00613.32
7.3.310.0070.00016.34
7.3.300.0000.00616.18
7.3.290.0090.00916.39
7.3.280.0100.00616.34
7.3.270.0110.00617.40
7.3.260.0120.00918.24
7.3.250.0120.00916.54
7.3.240.0040.01316.32
7.3.230.0140.00416.51
7.3.210.0100.00716.54
7.3.200.0060.01019.39
7.3.190.0090.01316.64
7.3.180.0000.01516.36
7.3.170.0100.00616.51
7.3.160.0040.01216.38
7.3.120.0150.00314.93
7.3.110.0100.00715.01
7.3.100.0030.00714.95
7.3.90.0040.00714.66
7.3.80.0070.01015.09
7.3.70.0080.00014.95
7.3.60.0100.00714.93
7.3.50.0060.00614.97
7.3.40.0070.01114.83
7.3.30.0070.00714.87
7.3.20.0120.00316.67
7.3.10.0000.00816.46
7.3.00.0090.00316.48
7.2.330.0110.01116.53
7.2.320.0100.01316.84
7.2.310.0080.00816.77
7.2.300.0070.01416.67
7.2.290.0080.00816.50
7.2.250.0060.00915.29
7.2.240.0040.01114.99
7.2.230.0040.00715.08
7.2.220.0070.00715.38
7.2.210.0040.01415.22
7.2.200.0060.00915.10
7.2.190.0060.01015.19
7.2.180.0060.00915.10
7.2.170.0060.00615.11
7.2.160.0060.01014.95
7.2.150.0070.01117.00
7.2.140.0040.00417.05
7.2.130.0040.00716.96
7.2.120.0030.00917.05
7.2.110.0040.00816.91
7.2.100.0050.00517.04
7.2.90.0000.01216.98
7.2.80.0060.00316.91
7.2.70.0000.01316.79
7.2.60.0080.00416.82
7.2.50.0090.00316.82
7.2.40.0060.00816.69
7.2.30.0030.01517.14
7.2.20.0000.01416.93
7.2.10.0070.00717.04
7.2.00.0080.00418.30
7.1.330.0000.01015.98
7.1.320.0060.00915.77
7.1.310.0030.01015.68
7.1.300.0090.00315.51
7.1.290.0080.00415.77
7.1.280.0060.01016.04
7.1.270.0060.00915.84
7.1.260.0030.00715.60
7.1.250.0060.00615.77
7.1.100.0040.01118.11
7.1.70.0030.00617.30
7.1.60.0100.01419.24
7.1.50.0030.02117.06
7.1.00.0030.03322.35
7.0.200.0000.01016.79
7.0.140.0030.06722.05
7.0.100.0130.08019.99
7.0.90.0130.07719.99
7.0.80.0100.09019.97
7.0.70.0230.06719.92
7.0.60.0270.07019.86
7.0.50.0100.06720.37
7.0.40.0100.08320.04
7.0.30.0100.07720.00
7.0.20.0170.07020.11
7.0.10.0200.06020.12
7.0.00.0170.07320.08
5.6.280.0070.07020.90
5.6.250.0070.05020.73
5.6.240.0130.07320.61
5.6.230.0000.07320.70
5.6.220.0170.07020.54
5.6.210.0130.07320.47
5.6.200.0170.07721.05
5.6.190.0070.08320.96
5.6.180.0200.05320.98
5.6.170.0070.08321.06
5.6.160.0100.07321.07
5.6.150.0070.08321.06
5.6.140.0070.08021.09
5.6.130.0070.09021.06
5.6.120.0070.05021.07
5.6.110.0000.04721.12
5.6.100.0070.07721.04
5.6.90.0030.09020.96
5.6.80.0100.07020.49
5.6.70.0030.08320.34
5.6.60.0130.06320.49
5.6.50.0000.07020.43
5.6.40.0030.08720.45
5.6.30.0200.07020.48
5.6.20.0000.08720.45
5.6.10.0070.08020.33
5.6.00.0100.08020.46
5.5.380.0130.07720.44
5.5.370.0030.05020.41
5.5.360.0030.06020.55
5.5.350.0130.07320.34
5.5.340.0100.07320.65
5.5.330.0100.04320.93
5.5.320.0230.06720.78
5.5.310.0070.08020.88
5.5.300.0030.06720.84
5.5.290.0100.07720.79
5.5.280.0070.08320.88
5.5.270.0000.06020.62
5.5.260.0230.08320.84
5.5.250.0170.07020.75
5.5.240.0070.05020.23
5.5.230.0070.08320.20
5.5.220.0070.07720.26
5.5.210.0030.05020.31
5.5.200.0170.07020.17
5.5.190.0170.06720.10
5.5.180.0130.07020.28
5.5.160.0130.07320.16
5.5.150.0070.07720.27
5.5.140.0170.06720.00
5.5.130.0070.07720.21
5.5.120.0170.07720.23
5.5.110.0070.07020.25
5.5.100.0000.08320.13
5.5.90.0200.06020.08
5.5.80.0100.07719.95
5.5.70.0030.08020.07
5.5.60.0100.07020.16
5.5.50.0100.07020.09
5.5.40.0070.06720.02
5.5.30.0070.04720.16
5.5.20.0100.07720.06
5.5.10.0030.05020.08
5.5.00.0100.07720.08
5.4.450.0070.08019.42
5.4.440.0030.05019.46
5.4.430.0100.07019.18
5.4.420.0030.08719.20
5.4.410.0070.07019.34
5.4.400.0100.03319.14
5.4.390.0030.08019.04
5.4.380.0200.06019.16
5.4.370.0100.06018.85
5.4.360.0030.08018.95
5.4.350.0000.08319.21
5.4.340.0070.07719.18
5.4.320.0000.08319.13
5.4.310.0130.06719.16
5.4.300.0030.07719.21
5.4.290.0070.08018.88
5.4.280.0070.06018.88
5.4.270.0300.05318.90
5.4.260.0170.06719.27
5.4.250.0300.05719.04
5.4.240.0130.07019.04
5.4.230.0030.07019.23
5.4.220.0100.05019.02
5.4.210.0170.07019.11
5.4.200.0070.07318.86
5.4.190.0130.07318.94
5.4.180.0070.06719.11
5.4.170.0170.07319.08
5.4.160.0030.07718.89
5.4.150.0070.07019.14
5.4.140.0230.05716.40
5.4.130.0100.03716.30
5.4.120.0070.07316.33
5.4.110.0100.07016.44
5.4.100.0030.07316.35
5.4.90.0000.08016.32
5.4.80.0130.03716.50
5.4.70.0030.07716.52
5.4.60.0100.07016.39
5.4.50.0070.04716.49
5.4.40.0070.08016.53
5.4.30.0170.06716.39
5.4.20.0070.07016.24
5.4.10.0000.07016.36
5.4.00.0070.07015.84
5.3.290.0230.06314.73
5.3.280.0170.07014.73
5.3.270.0100.04714.60
5.3.260.0100.07014.55
5.3.250.0070.06714.77
5.3.240.0030.08014.67
5.3.230.0070.07014.75
5.3.220.0100.07014.52
5.3.210.0030.04014.72
5.3.200.0070.07714.56
5.3.190.0000.06014.67
5.3.180.0070.04314.69
5.3.170.0130.05014.52
5.3.160.0030.07714.64
5.3.150.0170.07014.51
5.3.140.0100.06014.49
5.3.130.0130.04014.52
5.3.120.0100.07714.67
5.3.110.0100.07714.70
5.3.100.0030.07314.17
5.3.90.0200.04314.13
5.3.80.0100.07314.09
5.3.70.0070.06314.17
5.3.60.0100.07314.05
5.3.50.0030.07314.08
5.3.40.0130.06314.03
5.3.30.0070.04013.92
5.3.20.0100.03013.71
5.3.10.0070.03313.59
5.3.00.0000.04013.71
5.2.170.0070.04011.20
5.2.160.0130.05311.15
5.2.150.0130.04011.05
5.2.140.0070.04311.28
5.2.130.0070.02311.25
5.2.120.0100.02311.15
5.2.110.0030.05311.25
5.2.100.0000.03011.22
5.2.90.0030.03011.03
5.2.80.0030.02711.13
5.2.70.0070.03011.09
5.2.60.0070.02711.16
5.2.50.0030.02710.97
5.2.40.0030.03010.92
5.2.30.0000.03310.90
5.2.20.0030.02711.11
5.2.10.0000.03010.91
5.2.00.0000.03010.78
5.1.60.0000.04010.78
5.1.50.0030.02310.78
5.1.40.0000.02710.78
5.1.30.0030.02710.78
5.1.20.0070.02010.78
5.1.10.0000.02710.78
5.1.00.0000.02710.78
5.0.50.0030.02310.78
5.0.40.0030.01710.78
5.0.30.0000.03310.78
5.0.20.0100.03710.78
5.0.10.0000.02010.78
5.0.00.0070.02310.78
4.4.90.0030.01310.78
4.4.80.0000.01710.78
4.4.70.0000.01710.78
4.4.60.0000.01710.78
4.4.50.0030.01710.78
4.4.40.0030.02010.78
4.4.30.0030.01310.78
4.4.20.0000.02310.78
4.4.10.0000.02310.78
4.4.00.0030.02010.78
4.3.110.0000.01710.78
4.3.100.0070.03010.78
4.3.90.0030.01310.78
4.3.80.0000.03710.78
4.3.70.0030.02010.78
4.3.60.0000.02010.78
4.3.50.0000.02310.78
4.3.40.0070.01710.78
4.3.30.0030.01310.78
4.3.20.0000.01710.78
4.3.10.0000.01710.78
4.3.00.0030.01010.78

preferences:
52.67 ms | 401 KiB | 5 Q