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;

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.0050.01417.08
7.4.130.0120.00716.91
7.4.120.0150.00516.80
7.4.110.0120.00616.78
7.4.100.0090.00916.86
7.4.90.0040.01316.89
7.4.80.0190.00416.68
7.4.70.0070.01816.73
7.4.60.0100.01716.80
7.4.50.0160.00916.75
7.4.40.0130.01016.81
7.4.30.0060.01216.86
7.4.20.0090.00916.80
7.4.10.0170.00316.89
7.4.00.0120.00616.85
7.3.250.0030.01416.56
7.3.240.0080.01616.68
7.3.230.0090.00916.50
7.3.220.0110.00816.80
7.3.210.0150.00616.56
7.3.200.0100.01016.82
7.3.190.0100.01616.50
7.3.180.0120.00616.57
7.3.170.0140.00816.90
7.3.160.0070.01416.60
7.3.150.0100.00716.86
7.3.140.0060.01216.68
7.3.130.0060.01216.51
7.3.120.0090.00916.66
7.3.110.0090.00916.63
7.3.100.0160.00316.61
7.3.90.0070.01116.58
7.3.80.0100.01316.87
7.3.70.0110.00616.71
7.3.60.0080.01116.64
7.3.50.0130.00916.60
7.3.40.0170.00616.75
7.3.30.0110.01116.88
7.3.20.0540.00916.75
7.3.10.0180.00716.58
7.3.00.0120.01116.87

preferences:
36.39 ms | 401 KiB | 5 Q