@ 2020-12-03T21:10:53Z <?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;
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.013 0.006 16.97 7.4.13 0.006 0.013 16.85 7.4.12 0.011 0.007 16.85 7.4.11 0.009 0.009 17.01 7.4.10 0.013 0.003 16.79 7.4.9 0.006 0.012 16.78 7.4.8 0.007 0.011 16.58 7.4.7 0.011 0.007 16.72 7.4.6 0.016 0.003 16.73 7.4.5 0.015 0.003 16.93 7.4.4 0.004 0.020 16.82 7.4.3 0.008 0.011 16.76 7.4.2 0.013 0.007 16.89 7.4.1 0.010 0.008 16.70 7.4.0 0.007 0.010 16.82 7.3.25 0.006 0.012 16.82 7.3.24 0.011 0.007 16.49 7.3.23 0.007 0.010 16.84 7.3.22 0.003 0.013 16.79 7.3.21 0.007 0.010 16.95 7.3.20 0.004 0.013 16.74 7.3.19 0.009 0.009 16.53 7.3.18 0.007 0.010 16.63 7.3.17 0.010 0.014 16.58 7.3.16 0.008 0.011 16.63 7.3.15 0.008 0.012 16.80 7.3.14 0.007 0.011 16.56 7.3.13 0.000 0.017 16.96 7.3.12 0.010 0.007 16.54 7.3.11 0.013 0.003 16.79 7.3.10 0.004 0.012 16.86 7.3.9 0.011 0.006 16.88 7.3.8 0.016 0.000 16.54 7.3.7 0.011 0.005 16.72 7.3.6 0.013 0.005 16.66 7.3.5 0.010 0.006 16.80 7.3.4 0.014 0.003 16.71 7.3.3 0.007 0.010 16.64 7.3.2 0.003 0.013 16.65 7.3.1 0.003 0.015 16.80 7.3.0 0.010 0.006 16.88
preferences:dark mode live preview
31.84 ms | 400 KiB | 5 Q