3v4l.org

run code in 300+ PHP versions simultaneously
<?php // your code goes here $ip = "16be:aa9f:92c0:1806:f54b:09a7:d926:3d55"; $start = microtime(true); $ipchk = !!preg_match("/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/", $ip); $end = microtime(true); $start2 = microtime(true); $ipchk2 = !!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); $end2 = microtime(true); echo "preg_match:\n"; echo var_export($ipchk, true) . "\n"; echo ($end - $start) * 1000; echo "\n"; echo "filter_var:\n"; echo var_export($ipchk2, true) . "\n"; echo ($end2 - $start2) * 1000;
Output for 8.0.0
preg_match: true 0.88286399841309 filter_var: true 0.0040531158447266
Output for 7.4.13
preg_match: true 0.76723098754883 filter_var: true 0.0050067901611328
Output for 7.4.12
preg_match: true 0.73504447937012 filter_var: true 0.0050067901611328
Output for 7.4.11
preg_match: true 0.74601173400879 filter_var: true 0.0050067901611328
Output for 7.4.10
preg_match: true 0.78511238098145 filter_var: true 0.0050067901611328
Output for 7.4.9
preg_match: true 0.74505805969238 filter_var: true 0.0050067901611328
Output for 7.4.8
preg_match: true 1.2650489807129 filter_var: true 0.0050067901611328
Output for 7.4.7
preg_match: true 1.3899803161621 filter_var: true 0.0059604644775391
Output for 7.4.6
preg_match: true 2.1851062774658 filter_var: true 0.0059604644775391
Output for 7.4.5
preg_match: true 1.2071132659912 filter_var: true 0.0050067901611328
Output for 7.4.4
preg_match: true 1.2059211730957 filter_var: true 0.0050067901611328
Output for 7.4.3
preg_match: true 0.81706047058105 filter_var: true 0.0040531158447266
Output for 7.4.2
preg_match: true 0.91004371643066 filter_var: true 0.0050067901611328
Output for 7.4.1
preg_match: true 1.0278224945068 filter_var: true 0.0047683715820312
Output for 7.4.0
preg_match: true 0.77104568481445 filter_var: true 0.0050067901611328
Output for 7.3.25
preg_match: true 0.7469654083252 filter_var: true 0.0050067901611328
Output for 7.3.24
preg_match: true 1.1501312255859 filter_var: true 0.0059604644775391
Output for 7.3.23
preg_match: true 0.7469654083252 filter_var: true 0.0040531158447266
Output for 7.3.22
preg_match: true 0.7789134979248 filter_var: true 0.0030994415283203
Output for 7.3.21
preg_match: true 0.94199180603027 filter_var: true 0.0061988830566406
Output for 7.3.20
preg_match: true 1.0631084442139 filter_var: true 0.0050067901611328
Output for 7.3.19
preg_match: true 1.6710758209229 filter_var: true 0.0059604644775391
Output for 7.3.18
preg_match: true 0.71001052856445 filter_var: true 0.0040531158447266
Output for 7.3.17
preg_match: true 0.7939338684082 filter_var: true 0.0059604644775391
Output for 7.3.16
preg_match: true 0.75387954711914 filter_var: true 0.0040531158447266
Output for 7.3.15
preg_match: true 0.74911117553711 filter_var: true 0.0050067901611328
Output for 7.3.14
preg_match: true 0.84495544433594 filter_var: true 0.0040531158447266
Output for 7.3.13
preg_match: true 0.72193145751953 filter_var: true 0.0040531158447266
Output for 7.3.12
preg_match: true 0.70786476135254 filter_var: true 0.0040531158447266
Output for 7.3.11
preg_match: true 0.74005126953125 filter_var: true 0.0040531158447266
Output for 7.3.10
preg_match: true 0.75888633728027 filter_var: true 0.0047683715820312
Output for 7.3.9
preg_match: true 0.86402893066406 filter_var: true 0.0050067901611328
Output for 7.3.8
preg_match: true 1.0509490966797 filter_var: true 0.0059604644775391
Output for 7.3.7
preg_match: true 0.81920623779297 filter_var: true 0.0050067901611328
Output for 7.3.6
preg_match: true 1.1270046234131 filter_var: true 0.0059604644775391
Output for 7.3.5
preg_match: true 1.0309219360352 filter_var: true 0.0050067901611328
Output for 7.3.4
preg_match: true 0.73981285095215 filter_var: true 0.0050067901611328
Output for 7.3.3
preg_match: true 1.0049343109131 filter_var: true 0.0050067901611328
Output for 7.3.2
preg_match: true 1.0659694671631 filter_var: true 0.0059604644775391
Output for 7.3.1
preg_match: true 1.2938976287842 filter_var: true 0.0061988830566406
Output for 7.3.0
preg_match: true 1.007080078125 filter_var: true 0.0059604644775391

preferences:
36.17 ms | 466 KiB | 5 Q