3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ip = '127.0.0.1'; function test($ip) { if (false !== strpos($ip, '/')) { list($address, $netmask) = explode('/', $ip, 2); if ($netmask < 1 || $netmask > 32) { return false; } } else { $address = $ip; $netmask = 32; } $netmask = str_pad(str_pad('', $netmask, '1'), 32, '0'); $in_addr = ''; foreach(array_map('bindec', str_split($netmask, 8)) as $char) { $in_addr .= pack('C*', $char); } $netmask = inet_pton(inet_ntop($in_addr)); $network = (inet_pton($address) & $netmask); return array(inet_ntop($network), inet_ntop($network | ~$netmask)); } var_dump(test('127.0.0.1/24')); var_dump(test('10.0.0.3/29')); var_dump(test('192.168.1.16/8'));

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.0150.00617.00
8.3.50.0120.00822.05
8.3.40.0120.00318.94
8.3.30.0120.00319.00
8.3.20.0000.00820.59
8.3.10.0080.00023.63
8.3.00.0050.00319.51
8.2.180.0000.02216.88
8.2.170.0150.00422.96
8.2.160.0090.00919.58
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0090.00017.38
8.2.120.0040.00426.35
8.2.110.0060.00320.99
8.2.100.0100.00317.91
8.2.90.0050.00319.22
8.2.80.0000.00917.97
8.2.70.0030.00617.75
8.2.60.0000.00818.05
8.2.50.0030.00518.07
8.2.40.0080.00020.20
8.2.30.0050.00318.26
8.2.20.0000.00817.81
8.2.10.0050.00218.32
8.2.00.0040.00418.26
8.1.280.0110.00725.92
8.1.270.0080.00023.97
8.1.260.0000.00828.09
8.1.250.0070.00028.09
8.1.240.0040.00422.20
8.1.230.0110.00019.18
8.1.220.0030.00517.79
8.1.210.0080.00018.77
8.1.200.0060.00317.50
8.1.190.0090.00017.48
8.1.180.0000.00818.10
8.1.170.0040.00418.98
8.1.160.0000.00718.98
8.1.150.0040.00418.90
8.1.140.0030.00519.71
8.1.130.0070.00017.77
8.1.120.0000.00817.59
8.1.110.0040.00417.59
8.1.100.0050.00217.55
8.1.90.0040.00417.59
8.1.80.0040.00417.55
8.1.70.0030.00317.51
8.1.60.0000.00917.59
8.1.50.0030.00617.62
8.1.40.0040.00417.55
8.1.30.0060.00317.72
8.1.20.0030.00617.55
8.1.10.0040.00417.63
8.1.00.0040.00417.63
8.0.300.0040.00418.77
8.0.290.0080.00016.63
8.0.280.0030.00318.40
8.0.270.0000.01017.25
8.0.260.0000.00817.23
8.0.250.0070.00017.05
8.0.240.0040.00417.04
8.0.230.0070.00017.02
8.0.220.0000.00716.97
8.0.210.0040.00416.87
8.0.200.0000.00617.06
8.0.190.0030.00617.06
8.0.180.0040.00416.97
8.0.170.0080.00017.04
8.0.160.0040.00417.10
8.0.150.0050.00216.88
8.0.140.0050.00316.91
8.0.130.0040.00413.55
8.0.120.0080.00017.02
8.0.110.0040.00417.00
8.0.100.0080.00017.14
8.0.90.0040.00416.90
8.0.80.0120.00316.85
8.0.70.0050.00216.96
8.0.60.0080.00016.93
8.0.50.0040.00416.94
8.0.30.0110.00717.28
8.0.20.0120.01217.47
8.0.10.0000.00716.98
8.0.00.0100.01016.85
7.4.330.0050.00017.03
7.4.320.0000.00616.65
7.4.300.0000.00616.67
7.4.290.0030.00316.63
7.4.280.0030.00616.77
7.4.270.0030.00316.58
7.4.260.0000.00816.71
7.4.250.0030.00516.54
7.4.240.0020.00516.64
7.4.230.0080.00016.42
7.4.220.0160.00316.66
7.4.210.0050.01116.67
7.4.200.0040.00416.48
7.4.160.0070.01016.77
7.4.150.0150.01217.40
7.4.140.0120.00717.86
7.4.130.0140.00616.81
7.4.120.0100.00816.74
7.4.110.0070.01116.49
7.4.100.0100.01016.51
7.4.90.0070.01116.40
7.4.80.0070.01019.39
7.4.70.0100.00616.71
7.4.60.0080.00816.57
7.4.50.0030.01316.46
7.4.40.0070.01016.68
7.4.30.0120.00616.64
7.4.00.0080.00515.12
7.3.330.0020.00313.43
7.3.320.0020.00313.31
7.3.310.0040.00416.42
7.3.300.0030.00316.34
7.3.290.0030.00316.38
7.3.280.0140.00416.40
7.3.270.0000.01817.40
7.3.260.0080.01616.43
7.3.250.0110.00716.59
7.3.240.0070.01316.54
7.3.230.0140.00316.48
7.3.210.0170.00316.53
7.3.200.0080.00816.51
7.3.190.0080.00816.74
7.3.180.0040.01416.37
7.3.170.0100.00716.51
7.3.160.0100.00716.72
7.3.10.0100.00316.75
7.3.00.0160.00016.42
7.2.330.0160.00316.77
7.2.320.0090.01216.63
7.2.310.0090.00916.82
7.2.300.0170.00016.94
7.2.290.0030.01916.81
7.2.130.0130.00316.82
7.2.120.0120.00017.03
7.2.110.0090.00316.83
7.2.100.0060.00916.98
7.2.90.0060.00617.16
7.2.80.0030.00917.10
7.2.70.0070.00716.92
7.2.60.0040.00917.07
7.2.50.0060.00616.90
7.2.40.0060.00317.17
7.2.30.0100.00717.11
7.2.20.0000.01316.76
7.2.10.0000.01217.06
7.2.00.0030.01318.27
7.1.250.0080.00315.96
7.1.200.0070.00415.55
7.1.100.0030.01018.35
7.1.70.0000.00717.12
7.1.60.0070.01419.48
7.1.50.0000.01916.75
7.1.00.0070.07322.64
7.0.200.0270.00315.06
7.0.60.0000.06719.86
7.0.50.0070.05317.95
7.0.40.0030.08320.19
7.0.30.0370.05320.26
7.0.20.0270.05020.30
7.0.10.0100.05720.32
7.0.00.0070.04020.22
5.6.280.0030.05721.16
5.6.210.0030.05020.79
5.6.200.0070.05718.22
5.6.190.0070.08020.61
5.6.180.0300.04020.45
5.6.170.0270.07320.61
5.6.160.0030.07720.54
5.6.150.0070.08318.25
5.6.140.0100.08318.24
5.6.130.0130.08018.27
5.6.120.0100.04321.04
5.6.110.0200.07321.05
5.6.100.0130.07721.13
5.6.90.0100.08021.04
5.6.80.0100.06720.36
5.5.350.3570.03720.39
5.5.340.0100.07318.08
5.5.330.0030.05720.34
5.5.320.0000.07320.36
5.5.310.0200.06720.40
5.5.300.0130.08018.11
5.5.290.0100.05018.09
5.5.280.0200.05720.78
5.5.270.0030.04320.80
5.5.260.0270.06320.91
5.5.250.0030.09020.65
5.5.240.0400.07020.20

preferences:
59.71 ms | 401 KiB | 5 Q