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 ($end - $start) * 1000; echo "\n"; echo "filter_var:\n"; echo ($end2 - $start2) * 1000;
Output for 8.0.0
preg_match: 0.77986717224121 filter_var: 0.0040531158447266
Output for 7.4.13
preg_match: 0.86617469787598 filter_var: 0.0050067901611328
Output for 7.4.12
preg_match: 4.6231746673584 filter_var: 0.037908554077148
Output for 7.4.11
preg_match: 1.0380744934082 filter_var: 0.0059604644775391
Output for 7.4.10
preg_match: 1.0309219360352 filter_var: 0.003814697265625
Output for 7.4.9
preg_match: 0.72288513183594 filter_var: 0.0040531158447266
Output for 7.4.8
preg_match: 0.76103210449219 filter_var: 0.0040531158447266
Output for 7.4.7
preg_match: 0.7319450378418 filter_var: 0.0050067901611328
Output for 7.4.6
preg_match: 0.84900856018066 filter_var: 0.0040531158447266
Output for 7.4.5
preg_match: 1.2898445129395 filter_var: 0.0040531158447266
Output for 7.4.4
preg_match: 0.78296661376953 filter_var: 0.0040531158447266
Output for 7.4.3
preg_match: 1.0190010070801 filter_var: 0.03504753112793
Output for 7.4.2
preg_match: 1.0859966278076 filter_var: 0.0059604644775391
Output for 7.4.1
preg_match: 0.74911117553711 filter_var: 0.003814697265625
Output for 7.4.0
preg_match: 0.78916549682617 filter_var: 0.0050067901611328
Output for 7.3.25
preg_match: 0.77700614929199 filter_var: 0.003814697265625
Output for 7.3.24
preg_match: 6.8061351776123 filter_var: 0.0059604644775391
Output for 7.3.23
preg_match: 0.91099739074707 filter_var: 0.0050067901611328
Output for 7.3.22
preg_match: 0.72193145751953 filter_var: 0.0040531158447266
Output for 7.3.21
preg_match: 1.0571479797363 filter_var: 0.0050067901611328
Output for 7.3.20
preg_match: 0.762939453125 filter_var: 0.0040531158447266
Output for 7.3.19
preg_match: 0.71620941162109 filter_var: 0.0050067901611328
Output for 7.3.18
preg_match: 0.77486038208008 filter_var: 0.0040531158447266
Output for 7.3.17
preg_match: 0.82087516784668 filter_var: 0.0050067901611328
Output for 7.3.16
preg_match: 0.78201293945312 filter_var: 0.0050067901611328
Output for 7.3.15
preg_match: 0.73790550231934 filter_var: 0.0050067901611328
Output for 7.3.14
preg_match: 0.73003768920898 filter_var: 0.0050067901611328
Output for 7.3.13
preg_match: 0.83613395690918 filter_var: 0.0050067901611328
Output for 7.3.6, 7.3.12
preg_match: 0.75006484985352 filter_var: 0.0040531158447266
Output for 7.3.11
preg_match: 1.0719299316406 filter_var: 0.0059604644775391
Output for 7.3.10
preg_match: 1.4379024505615 filter_var: 0.0061988830566406
Output for 7.3.9
preg_match: 0.78392028808594 filter_var: 0.0050067901611328
Output for 7.3.8
preg_match: 0.74386596679688 filter_var: 0.0050067901611328
Output for 7.3.7
preg_match: 0.96392631530762 filter_var: 0.0040531158447266
Output for 7.3.5
preg_match: 0.72598457336426 filter_var: 0.003814697265625
Output for 7.3.4
preg_match: 1.0170936584473 filter_var: 0.0050067901611328
Output for 7.3.3
preg_match: 0.93293190002441 filter_var: 0.0050067901611328
Output for 7.3.2
preg_match: 0.76794624328613 filter_var: 0.0050067901611328
Output for 7.3.1
preg_match: 0.73909759521484 filter_var: 0.0050067901611328
Output for 7.3.0
preg_match: 2.032995223999 filter_var: 0.0040531158447266

preferences:
26.27 ms | 464 KiB | 5 Q