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;

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.0120.00717.19
7.4.130.0180.00417.10
7.4.120.0100.01416.79
7.4.110.0090.01416.91
7.4.100.0090.00916.80
7.4.90.0150.00516.68
7.4.80.0090.00916.96
7.4.70.0070.01116.75
7.4.60.0120.00616.83
7.4.50.0140.01317.00
7.4.40.0030.01516.70
7.4.30.0130.00516.81
7.4.20.0090.01516.88
7.4.10.0120.00616.72
7.4.00.0120.00616.57
7.3.250.0070.01116.61
7.3.240.0160.00416.87
7.3.230.0040.01416.78
7.3.220.0140.00416.84
7.3.210.0110.00816.87
7.3.200.0050.01316.83
7.3.190.0070.01016.58
7.3.180.0090.00916.54
7.3.170.0070.01116.83
7.3.160.0100.00716.73
7.3.150.0110.00716.82
7.3.140.0140.00316.57
7.3.130.0120.00616.88
7.3.120.0000.01716.61
7.3.110.0120.00616.53
7.3.100.0130.01316.63
7.3.90.0080.00816.95
7.3.80.0140.00416.83
7.3.70.0150.00616.72
7.3.60.0070.01016.73
7.3.50.0000.01716.79
7.3.40.0080.00816.58
7.3.30.0110.00516.72
7.3.20.0070.01016.60
7.3.10.0110.00716.81
7.3.00.0100.00716.74

preferences:
11.5 ms | 406 KiB | 5 Q