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;

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.0.00.0130.00616.97
7.4.130.0060.01316.85
7.4.120.0110.00716.85
7.4.110.0090.00917.01
7.4.100.0130.00316.79
7.4.90.0060.01216.78
7.4.80.0070.01116.58
7.4.70.0110.00716.72
7.4.60.0160.00316.73
7.4.50.0150.00316.93
7.4.40.0040.02016.82
7.4.30.0080.01116.76
7.4.20.0130.00716.89
7.4.10.0100.00816.70
7.4.00.0070.01016.82
7.3.250.0060.01216.82
7.3.240.0110.00716.49
7.3.230.0070.01016.84
7.3.220.0030.01316.79
7.3.210.0070.01016.95
7.3.200.0040.01316.74
7.3.190.0090.00916.53
7.3.180.0070.01016.63
7.3.170.0100.01416.58
7.3.160.0080.01116.63
7.3.150.0080.01216.80
7.3.140.0070.01116.56
7.3.130.0000.01716.96
7.3.120.0100.00716.54
7.3.110.0130.00316.79
7.3.100.0040.01216.86
7.3.90.0110.00616.88
7.3.80.0160.00016.54
7.3.70.0110.00516.72
7.3.60.0130.00516.66
7.3.50.0100.00616.80
7.3.40.0140.00316.71
7.3.30.0070.01016.64
7.3.20.0030.01316.65
7.3.10.0030.01516.80
7.3.00.0100.00616.88

preferences:
11.86 ms | 406 KiB | 5 Q