3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cidr_match($ip, $range){ list ($subnet, $bits) = explode('/', $range); if ($bits === null) { $bits = 32; } $ip = ip2long($ip); $subnet = ip2long($subnet); $mask = -1 << (32 - $bits); $subnet &= $mask; # nb: in case the supplied subnet wasn't correctly aligned return ($ip & $mask) == $subnet; } var_dump(cidr_match('79.142.17.1', '79.142.16.0/20')); var_dump(cidr_match('79.142.35.4', '79.142.16.0/20'));
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) bool(false)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
25.29 ms | 405 KiB | 5 Q