@ 2020-12-03T20:37:27Z <?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;
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.012 0.007 17.19 7.4.13 0.018 0.004 17.10 7.4.12 0.010 0.014 16.79 7.4.11 0.009 0.014 16.91 7.4.10 0.009 0.009 16.80 7.4.9 0.015 0.005 16.68 7.4.8 0.009 0.009 16.96 7.4.7 0.007 0.011 16.75 7.4.6 0.012 0.006 16.83 7.4.5 0.014 0.013 17.00 7.4.4 0.003 0.015 16.70 7.4.3 0.013 0.005 16.81 7.4.2 0.009 0.015 16.88 7.4.1 0.012 0.006 16.72 7.4.0 0.012 0.006 16.57 7.3.25 0.007 0.011 16.61 7.3.24 0.016 0.004 16.87 7.3.23 0.004 0.014 16.78 7.3.22 0.014 0.004 16.84 7.3.21 0.011 0.008 16.87 7.3.20 0.005 0.013 16.83 7.3.19 0.007 0.010 16.58 7.3.18 0.009 0.009 16.54 7.3.17 0.007 0.011 16.83 7.3.16 0.010 0.007 16.73 7.3.15 0.011 0.007 16.82 7.3.14 0.014 0.003 16.57 7.3.13 0.012 0.006 16.88 7.3.12 0.000 0.017 16.61 7.3.11 0.012 0.006 16.53 7.3.10 0.013 0.013 16.63 7.3.9 0.008 0.008 16.95 7.3.8 0.014 0.004 16.83 7.3.7 0.015 0.006 16.72 7.3.6 0.007 0.010 16.73 7.3.5 0.000 0.017 16.79 7.3.4 0.008 0.008 16.58 7.3.3 0.011 0.005 16.72 7.3.2 0.007 0.010 16.60 7.3.1 0.011 0.007 16.81 7.3.0 0.010 0.007 16.74
preferences:dark mode live preview
11.5 ms | 406 KiB | 5 Q