3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( '192.168.11.12/24', '62.10.11.12/32', '128.10.11.12/8', '96.50.51.52/16', '192.168.1.188/27' ); $b = array( '192.168.128.0', // kein Treffer '192.168.11.255', // Treffer '62.10.11.255', // kein Treffer '62.10.11.12', // Treffer '128.255.255.255', // Treffer '129.255.255.255', // kein Treffer '96.50.255.255', // Treffer '97.50.51.52', // kein Treffer '192.168.1.189', // Treffer '192.168.1.89' // kein Treffer ); function f(array $a) { $new = array(); foreach ($a as $item) { list($ipv4, $cidr) = explode('/', $item); $iplong = ip2long($ipv4); $iplong >>= 32 - $cidr; if (!isset($new[$cidr])) { $new[$cidr] = array(); } $new[$cidr][$iplong] = true; } return $new; } function g(array $a2, array $b) { foreach ($b as $item) { $iplong = ip2long($item); for ($i = 1; $i <= 32; $i++) { if (isset($a2[$i][$iplong >> 32 - $i])) { echo $item . '- Treffer' . '(' . $i . ')' . "\n"; continue 2; } } echo $item . ' - kein Treffer' . "\n"; } } $a2 = f($a); g($a2, $b);

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.0040.01116.63
8.3.50.0030.01316.35
8.3.40.0120.00619.12
8.3.30.0040.01118.92
8.3.20.0040.00419.05
8.3.10.0000.00821.81
8.3.00.0030.00521.86
8.2.180.0100.01016.50
8.2.170.0110.00722.96
8.2.160.0090.00622.20
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0070.00022.43
8.2.120.0060.00326.35
8.2.110.0080.00420.30
8.2.100.0060.00618.15
8.2.90.0040.00418.28
8.2.80.0030.00518.05
8.2.70.0040.00417.93
8.2.60.0000.00818.34
8.2.50.0040.00418.10
8.2.40.0040.00420.72
8.2.30.0040.00419.24
8.2.20.0000.00818.06
8.2.10.0000.00718.12
8.2.00.0000.00817.87
8.1.280.0110.00725.92
8.1.270.0060.00323.86
8.1.260.0040.00428.09
8.1.250.0060.00328.09
8.1.240.0090.00419.03
8.1.230.0040.00721.02
8.1.220.0050.00317.77
8.1.210.0040.00418.77
8.1.200.0030.00717.48
8.1.190.0080.00017.35
8.1.180.0060.00318.10
8.1.170.0030.00718.71
8.1.160.0040.00423.98
8.1.150.0080.00018.91
8.1.140.0080.00019.51
8.1.130.0030.00317.76
8.1.120.0030.00517.42
8.1.110.0020.00517.57
8.1.100.0000.00717.51
8.1.90.0040.00417.57
8.1.80.0000.00817.39
8.1.70.0040.00417.54
8.1.60.0000.00917.53
8.1.50.0080.00017.63
8.1.40.0090.00017.56
8.1.30.0000.00817.79
8.1.20.0030.00517.73
8.1.10.0000.00817.65
8.1.00.0040.00417.54
8.0.300.0070.00019.85
8.0.290.0040.00416.88
8.0.280.0000.00718.41
8.0.270.0030.00717.28
8.0.260.0030.00317.31
8.0.250.0080.00017.02
8.0.240.0000.00817.06
8.0.230.0040.00417.04
8.0.220.0030.00316.90
8.0.210.0030.00316.95
8.0.200.0030.00317.07
8.0.190.0000.00716.95
8.0.180.0000.00817.05
8.0.170.0000.00817.02
8.0.160.0000.00816.88
8.0.150.0060.00316.86
8.0.140.0030.00316.97
8.0.130.0000.00613.43
8.0.120.0040.00417.02
8.0.110.0070.00016.89
8.0.100.0050.00317.03
8.0.90.0040.00417.00
8.0.80.0030.01516.99
8.0.70.0080.00017.03
8.0.60.0000.00816.84
8.0.50.0030.00316.89
8.0.30.0090.00917.13
8.0.20.0090.01217.40
8.0.10.0000.00817.00
8.0.00.0070.01817.10
7.4.330.0000.00515.55
7.4.320.0030.00316.47
7.4.300.0000.00616.42
7.4.290.0040.00416.66
7.4.280.0040.00416.57
7.4.270.0070.00016.59
7.4.260.0000.00716.64
7.4.250.0030.00316.45
7.4.240.0020.00616.62
7.4.230.0000.00716.51
7.4.220.0080.00716.75
7.4.210.0100.01016.43
7.4.200.0000.00716.75
7.4.160.0090.00716.54
7.4.150.0140.00317.40
7.4.140.0100.00917.86
7.4.130.0080.01016.64
7.4.120.0060.01116.73
7.4.110.0100.00716.50
7.4.100.0120.00616.52
7.4.90.0130.00616.50
7.4.80.0030.01319.39
7.4.70.0030.01316.74
7.4.60.0160.00316.41
7.4.50.0100.00316.41
7.4.40.0100.01316.61
7.4.30.0070.01316.79
7.4.00.0030.00914.91
7.3.330.0000.00613.40
7.3.320.0030.00313.20
7.3.310.0030.00316.52
7.3.300.0070.00016.35
7.3.290.0070.00716.39
7.3.280.0110.00816.44
7.3.270.0130.00417.40
7.3.260.0080.01016.54
7.3.250.0040.01316.46
7.3.240.0090.01116.47
7.3.230.0130.00416.66
7.3.210.0040.01416.59
7.3.200.0070.01016.71
7.3.190.0130.00416.69
7.3.180.0070.01416.24
7.3.170.0100.00716.56
7.3.160.0070.01016.57
7.2.330.0150.00316.74
7.2.320.0090.00916.43
7.2.310.0100.00716.48
7.2.300.0140.00616.82
7.2.290.0110.00716.67
7.2.80.0090.00616.58
7.2.60.0100.00017.14
7.1.200.0000.01316.02
7.1.70.0000.00717.31
7.1.60.0000.01117.38
7.1.50.0100.01717.20
7.1.40.0040.00716.69
7.1.30.0070.00316.71
7.1.20.0000.01216.59
7.1.10.0000.01016.59
7.1.00.0030.00516.62
7.0.200.0040.00416.91
7.0.190.0030.00916.81
7.0.180.0040.00416.26
7.0.170.0040.00416.39
7.0.160.0110.00016.28
7.0.150.0040.00416.23
7.0.140.0090.00616.29
7.0.130.0040.00416.60
7.0.120.0060.00316.74
7.0.110.0000.00816.43
7.0.100.0060.01016.42
7.0.90.0000.01316.61
7.0.80.0030.00616.67
7.0.70.0000.01316.30
7.0.60.0000.00716.30
7.0.50.0000.00716.39
7.0.40.0040.00416.09
7.0.30.0000.01616.09
7.0.20.0000.00916.09
7.0.10.0040.00416.09
7.0.00.0030.00716.09
5.6.300.0100.04320.64
5.6.290.0070.03920.56
5.6.280.0070.04321.07
5.6.270.0100.03321.12
5.6.260.0030.04120.85
5.6.250.0000.04620.88
5.6.240.0000.07420.94
5.6.230.0030.04220.92
5.6.220.0030.03921.03
5.6.210.0000.04420.66
5.6.200.0000.04820.87
5.6.190.0000.04820.82
5.6.180.0100.07820.82
5.6.170.0100.03520.98
5.6.160.0030.04220.96
5.6.150.0000.04920.94
5.6.140.0030.04920.83
5.6.130.0000.04421.03
5.6.120.0070.04320.94
5.6.110.0000.05620.88
5.6.100.0070.04920.93
5.6.90.0000.05621.00
5.6.80.0040.03920.12
5.6.70.0030.04020.27
5.6.60.0030.08720.31
5.6.50.0030.05920.29
5.6.40.0070.03420.41
5.6.30.0060.03920.23
5.6.20.0000.04620.42
5.6.10.0040.03920.39
5.6.00.0000.04420.36

preferences:
68.85 ms | 401 KiB | 5 Q