@ 2020-12-03T21:09:14Z <?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;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
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).
Version System time (s) User time (s) Memory (MiB) 8.0.0 0.005 0.014 17.08 7.4.13 0.012 0.007 16.91 7.4.12 0.015 0.005 16.80 7.4.11 0.012 0.006 16.78 7.4.10 0.009 0.009 16.86 7.4.9 0.004 0.013 16.89 7.4.8 0.019 0.004 16.68 7.4.7 0.007 0.018 16.73 7.4.6 0.010 0.017 16.80 7.4.5 0.016 0.009 16.75 7.4.4 0.013 0.010 16.81 7.4.3 0.006 0.012 16.86 7.4.2 0.009 0.009 16.80 7.4.1 0.017 0.003 16.89 7.4.0 0.012 0.006 16.85 7.3.25 0.003 0.014 16.56 7.3.24 0.008 0.016 16.68 7.3.23 0.009 0.009 16.50 7.3.22 0.011 0.008 16.80 7.3.21 0.015 0.006 16.56 7.3.20 0.010 0.010 16.82 7.3.19 0.010 0.016 16.50 7.3.18 0.012 0.006 16.57 7.3.17 0.014 0.008 16.90 7.3.16 0.007 0.014 16.60 7.3.15 0.010 0.007 16.86 7.3.14 0.006 0.012 16.68 7.3.13 0.006 0.012 16.51 7.3.12 0.009 0.009 16.66 7.3.11 0.009 0.009 16.63 7.3.10 0.016 0.003 16.61 7.3.9 0.007 0.011 16.58 7.3.8 0.010 0.013 16.87 7.3.7 0.011 0.006 16.71 7.3.6 0.008 0.011 16.64 7.3.5 0.013 0.009 16.60 7.3.4 0.017 0.006 16.75 7.3.3 0.011 0.011 16.88 7.3.2 0.054 0.009 16.75 7.3.1 0.018 0.007 16.58 7.3.0 0.012 0.011 16.87
preferences:dark mode live preview
36.39 ms | 401 KiB | 5 Q