3v4l.org

run code in 300+ PHP versions simultaneously
<?php // your code goes here $ip = "136be:aa9f:92c0:1806:f54b:09a7:d926:fd55"; $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: false 0.73599815368652 filter_var: false 0.0028610229492188
Output for 7.4.13
preg_match: false 0.88095664978027 filter_var: false 0.0050067901611328
Output for 7.3.25, 7.4.12
preg_match: false 0.75292587280273 filter_var: false 0.0040531158447266
Output for 7.4.11
preg_match: false 0.74005126953125 filter_var: false 0.0040531158447266
Output for 7.4.10
preg_match: false 1.1539459228516 filter_var: false 0.0050067901611328
Output for 7.4.9
preg_match: false 1.0509490966797 filter_var: false 0.0040531158447266
Output for 7.3.19, 7.4.8
preg_match: false 0.79488754272461 filter_var: false 0.0040531158447266
Output for 7.4.7
preg_match: false 0.90599060058594 filter_var: false 0.0059604644775391
Output for 7.4.6
preg_match: false 1.0690689086914 filter_var: false 0.0050067901611328
Output for 7.4.5
preg_match: false 0.75387954711914 filter_var: false 0.0050067901611328
Output for 7.4.4
preg_match: false 1.1601448059082 filter_var: false 0.0050067901611328
Output for 7.4.3
preg_match: false 1.223087310791 filter_var: false 0.0050067901611328
Output for 7.4.2
preg_match: false 0.73885917663574 filter_var: false 0.0050067901611328
Output for 7.4.1
preg_match: false 1.025915145874 filter_var: false 0.0050067901611328
Output for 7.4.0
preg_match: false 2.1622180938721 filter_var: false 0.0059604644775391
Output for 7.3.24
preg_match: false 0.74601173400879 filter_var: false 0.0040531158447266
Output for 7.3.23
preg_match: false 0.76413154602051 filter_var: false 0.003814697265625
Output for 7.3.22
preg_match: false 0.83208084106445 filter_var: false 0.0040531158447266
Output for 7.3.21
preg_match: false 0.83494186401367 filter_var: false 0.0050067901611328
Output for 7.3.20
preg_match: false 2.0351409912109 filter_var: false 0.0040531158447266
Output for 7.3.18
preg_match: false 0.72121620178223 filter_var: false 0.003814697265625
Output for 7.3.17
preg_match: false 1.2111663818359 filter_var: false 0.003814697265625
Output for 7.3.16
preg_match: false 0.96583366394043 filter_var: false 0.0050067901611328
Output for 7.3.15
preg_match: false 0.78988075256348 filter_var: false 0.0050067901611328
Output for 7.3.14
preg_match: false 0.823974609375 filter_var: false 0.0028610229492188
Output for 7.3.13
preg_match: false 2.5510787963867 filter_var: false 0.0050067901611328
Output for 7.3.12
preg_match: false 0.77319145202637 filter_var: false 0.003814697265625
Output for 7.3.11
preg_match: false 0.78892707824707 filter_var: false 0.0050067901611328
Output for 7.3.10
preg_match: false 0.97489356994629 filter_var: false 0.0050067901611328
Output for 7.3.9
preg_match: false 1.8069744110107 filter_var: false 0.0050067901611328
Output for 7.3.8
preg_match: false 0.75888633728027 filter_var: false 0.0050067901611328
Output for 7.3.7
preg_match: false 0.88214874267578 filter_var: false 0.0050067901611328
Output for 7.3.6
preg_match: false 1.3492107391357 filter_var: false 0.0040531158447266
Output for 7.3.5
preg_match: false 0.73695182800293 filter_var: false 0.0040531158447266
Output for 7.3.4
preg_match: false 1.378059387207 filter_var: false 0.0050067901611328
Output for 7.3.3
preg_match: false 0.7939338684082 filter_var: false 0.0040531158447266
Output for 7.3.2
preg_match: false 1.0809898376465 filter_var: false 0.0040531158447266
Output for 7.3.1
preg_match: false 1.3020038604736 filter_var: false 0.0050067901611328
Output for 7.3.0
preg_match: false 0.92601776123047 filter_var: false 0.0050067901611328

preferences:
32.3 ms | 463 KiB | 5 Q