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.15.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.40.0110.00418.83
8.3.30.0110.00418.79
8.3.20.0080.00020.34
8.3.10.0080.00021.89
8.3.00.0090.00019.40
8.2.170.0070.00722.96
8.2.160.0110.00420.38
8.2.150.0080.00024.18
8.2.140.0020.00524.66
8.2.130.0040.00420.84
8.2.120.0040.00426.35
8.2.110.0070.00322.13
8.2.100.0090.00317.90
8.2.90.0000.00819.38
8.2.80.0080.00018.18
8.2.70.0040.00417.75
8.2.60.0080.00017.93
8.2.50.0040.00418.15
8.2.40.0040.00420.52
8.2.30.0040.00421.04
8.2.20.0070.00018.09
8.2.10.0020.00518.08
8.2.00.0040.00418.14
8.1.270.0040.00422.13
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00624.04
8.1.230.0090.00317.89
8.1.220.0060.00317.91
8.1.210.0000.00818.77
8.1.200.0040.00717.35
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0000.00818.59
8.1.160.0040.00419.02
8.1.150.0070.00018.98
8.1.140.0070.00019.63
8.1.130.0030.00318.90
8.1.120.0050.00217.55
8.1.110.0040.00417.53
8.1.100.0040.00417.54
8.1.90.0000.00717.55
8.1.80.0030.00417.44
8.1.70.0000.00717.54
8.1.60.0040.00417.56
8.1.50.0040.00417.45
8.1.40.0030.00517.66
8.1.30.0030.00617.65
8.1.20.0090.00317.64
8.1.10.0080.00017.57
8.1.00.0040.00417.60
8.0.300.0000.00718.77
8.0.290.0050.00216.88
8.0.280.0000.00718.38
8.0.270.0030.00317.25
8.0.260.0000.00617.00
8.0.250.0000.00717.02
8.0.240.0000.00717.13
8.0.230.0070.00017.09
8.0.220.0070.00017.05
8.0.210.0070.00017.01
8.0.200.0030.00617.07
8.0.190.0090.00316.98
8.0.180.0070.00017.11
8.0.170.0050.00217.10
8.0.160.0040.00417.01
8.0.150.0000.00817.01
8.0.140.0030.00516.91
8.0.130.0000.00613.52
8.0.120.0070.00017.03
8.0.110.0040.00416.93
8.0.100.0070.00017.07
8.0.90.0030.00617.09
8.0.80.0060.00917.09
8.0.70.0040.00416.93
8.0.60.0030.00517.12
8.0.50.0030.00616.95
8.0.30.0100.00717.19
8.0.20.0140.00617.44
8.0.10.0000.00717.14
8.0.00.0180.00316.84
7.4.330.0050.00015.55
7.4.320.0000.00616.60
7.4.300.0030.00316.75
7.4.290.0040.00416.68
7.4.280.0000.00916.49
7.4.270.0080.00016.61
7.4.260.0030.00316.73
7.4.250.0030.00616.66
7.4.240.0000.00716.61
7.4.230.0030.00316.80
7.4.220.0110.01116.78
7.4.210.0000.01516.57
7.4.200.0070.00016.76
7.4.160.0050.01116.60
7.4.150.0180.00017.40
7.4.140.0060.01117.86
7.4.130.0190.00016.56
7.4.120.0090.01116.63
7.4.110.0110.00716.77
7.4.100.0090.01316.61
7.4.90.0060.01216.61
7.4.80.0120.00419.39
7.4.70.0060.01016.83
7.4.60.0070.01116.61
7.4.50.0000.01016.65
7.4.40.0090.00816.59
7.4.30.0060.00916.75
7.4.00.0000.01315.14
7.3.330.0050.00013.43
7.3.320.0030.00313.46
7.3.310.0030.00316.34
7.3.300.0040.00416.34
7.3.290.0040.01016.49
7.3.280.0100.00816.44
7.3.270.0170.00017.40
7.3.260.0130.00416.44
7.3.250.0080.00916.53
7.3.240.0100.00716.62
7.3.230.0100.00716.60
7.3.210.0070.01016.54
7.3.200.0030.01316.48
7.3.190.0120.00816.43
7.3.180.0090.00616.62
7.3.170.0150.00716.52
7.3.160.0050.01116.51
7.2.330.0090.00916.70
7.2.320.0050.01416.80
7.2.310.0120.00616.73
7.2.300.0070.01016.79
7.2.290.0080.00816.54
7.2.60.0040.01116.68
7.2.00.0060.00319.40
7.1.200.0030.01015.64
7.1.100.0100.00618.04
7.1.70.0040.00717.17
7.1.60.0100.01435.18
7.1.50.0180.00634.55
7.1.40.0190.00934.47
7.1.30.0090.01634.54
7.1.20.0070.01934.33
7.1.10.0000.01216.53
7.1.00.0000.01316.63
7.0.200.0070.00416.60
7.0.190.0040.00716.46
7.0.180.0060.00616.26
7.0.170.0030.00916.23
7.0.160.0030.01216.33
7.0.150.0030.01016.18
7.0.140.0060.00616.29
7.0.130.0040.00816.63
7.0.120.0000.01216.71
7.0.110.0040.00816.61
7.0.100.0030.00916.31
7.0.90.0040.01116.42
7.0.80.0040.00816.37
7.0.70.0000.01216.27
7.0.60.0000.01116.14
7.0.50.0060.00616.48
7.0.40.0000.01216.60
7.0.30.0060.00616.60
7.0.20.0030.00916.66
7.0.10.0030.00816.29
7.0.00.0080.00416.47

preferences:
27.8 ms | 400 KiB | 5 Q