3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Check if a given ip is in a network * @param string $ip IP to check in IPV4 format eg. 127.0.0.1 * @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed * @return boolean true if the ip is in this range / false if not. */ function ip_in_range( $ip, $range ) { if ( strpos( $range, '/' ) == false ) { $range .= '/32'; } // $range is in IP/CIDR format eg 127.0.0.1/24 list( $range, $netmask ) = explode( '/', $range, 2 ); $range_decimal = ip2long( $range ); $ip_decimal = ip2long( $ip ); $wildcard_decimal = pow( 2, ( 32 - $netmask ) ) - 1; $netmask_decimal = ~ $wildcard_decimal; return ( ( $ip_decimal & $netmask_decimal ) == ( $range_decimal & $netmask_decimal ) ); } var_dump(ip_in_range("204.16.20.0", "204.15.20.0/22"));

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.00916.50
8.3.50.0140.00716.63
8.3.40.0040.01118.92
8.3.30.0110.00318.85
8.3.20.0060.00320.31
8.3.10.0040.00422.03
8.3.00.0050.00319.38
8.2.180.0140.00416.63
8.2.170.0040.01122.96
8.2.160.0070.00720.52
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0000.00720.94
8.2.120.0050.00326.35
8.2.110.0060.00321.18
8.2.100.0110.00018.03
8.2.90.0060.00319.36
8.2.80.0050.00318.16
8.2.70.0030.00517.75
8.2.60.0000.00718.05
8.2.50.0050.00318.10
8.2.40.0060.00320.73
8.2.30.0090.00021.07
8.2.20.0050.00318.33
8.2.10.0000.00718.22
8.2.00.0080.00018.20
8.1.280.0090.00625.92
8.1.270.0040.00422.17
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0050.00323.98
8.1.230.0120.00019.16
8.1.220.0000.00917.79
8.1.210.0030.00718.77
8.1.200.0000.01017.38
8.1.190.0000.00817.22
8.1.180.0000.00718.10
8.1.170.0000.00818.71
8.1.160.0040.00419.11
8.1.150.0050.00220.65
8.1.140.0040.00419.78
8.1.130.0040.00418.99
8.1.120.0040.00417.47
8.1.110.0060.00317.52
8.1.100.0000.00817.46
8.1.90.0000.00717.51
8.1.80.0040.00417.51
8.1.70.0080.00017.58
8.1.60.0040.00417.64
8.1.50.0050.00317.52
8.1.40.0000.00817.50
8.1.30.0000.00817.66
8.1.20.0110.00317.79
8.1.10.0000.00717.70
8.1.00.0040.00417.49
8.0.300.0050.00318.77
8.0.290.0040.00416.88
8.0.280.0000.00718.50
8.0.270.0030.00517.31
8.0.260.0030.00316.94
8.0.250.0030.00317.05
8.0.240.0000.00717.10
8.0.230.0040.00417.07
8.0.220.0040.00417.03
8.0.210.0070.00017.09
8.0.200.0000.00717.10
8.0.190.0060.00617.07
8.0.180.0040.00417.04
8.0.170.0050.00217.13
8.0.160.0050.00317.05
8.0.150.0020.00516.89
8.0.140.0070.00017.05
8.0.130.0030.00613.41
8.0.120.0040.00416.91
8.0.110.0000.00717.11
8.0.100.0040.00417.04
8.0.90.0000.00717.01
8.0.80.0060.01016.99
8.0.70.0050.00316.98
8.0.60.0000.00816.85
8.0.50.0020.00517.05
8.0.30.0090.00817.05
8.0.20.0120.00617.43
8.0.10.0040.00417.18
8.0.00.0110.00716.75
7.4.330.0050.00015.55
7.4.320.0030.00316.69
7.4.300.0050.00316.69
7.4.290.0030.00316.61
7.4.280.0080.00016.60
7.4.270.0030.00316.55
7.4.260.0040.00416.57
7.4.250.0040.00416.62
7.4.240.0040.00416.62
7.4.230.0070.00016.50
7.4.220.0090.00916.71
7.4.210.0150.00616.80
7.4.200.0030.00316.63
7.4.160.0060.01316.44
7.4.150.0100.00717.40
7.4.140.0070.01117.86
7.4.130.0130.00716.89
7.4.120.0130.00916.65
7.4.110.0120.00616.62
7.4.100.0130.00916.83
7.4.90.0140.00316.55
7.4.80.0080.00819.39
7.4.70.0040.01216.75
7.4.60.0120.00616.57
7.4.50.0120.00616.66
7.4.40.0130.00316.58
7.4.30.0130.00316.58
7.4.00.0000.01714.92
7.3.330.0020.00213.31
7.3.320.0000.00713.29
7.3.310.0030.00316.35
7.3.300.0000.00616.37
7.3.290.0070.00816.40
7.3.280.0080.00916.41
7.3.270.0120.00517.40
7.3.260.0090.00816.59
7.3.250.0110.00816.43
7.3.240.0090.00816.51
7.3.230.0150.00316.59
7.3.210.0060.00916.43
7.3.200.0100.00516.39
7.3.190.0090.01216.65
7.3.180.0030.01216.47
7.3.170.0060.01516.48
7.3.160.0080.00816.43
7.2.330.0140.00416.45
7.2.320.0100.00716.87
7.2.310.0090.00916.71
7.2.300.0070.01116.46
7.2.290.0120.00416.40
7.2.60.0070.01016.83
7.1.200.0190.00315.86
7.1.70.0040.00817.09
7.1.60.0140.01135.06
7.1.50.0150.00934.52
7.1.40.0170.01034.57
7.1.30.0130.01334.41
7.1.20.0230.00334.47
7.1.10.0000.01216.61
7.1.00.0040.00816.67
7.0.200.0060.00616.77
7.0.190.0060.00616.79
7.0.180.0090.00316.33
7.0.170.0050.00816.24
7.0.160.0060.00616.43
7.0.150.0000.01216.16
7.0.140.0030.00916.31
7.0.130.0130.00016.63
7.0.120.0050.00816.50
7.0.110.0070.01016.43
7.0.100.0000.01716.34
7.0.90.0090.00316.32
7.0.80.0000.01216.32
7.0.70.0050.00516.42
7.0.60.0100.00316.23
7.0.50.0080.00416.44
7.0.40.0000.01216.50
7.0.30.0030.00916.79
7.0.20.0030.00916.60
7.0.10.0080.00416.59
7.0.00.0030.01016.46

preferences:
35.91 ms | 400 KiB | 5 Q