• Resolved Anonymous User 17880307

    (@anonymized-17880307)


    I do not know the reason why the big regular expression is used (and where it is from) to check if a string is an IPv6 address. Also I am not sure why the regular expression tries to match a string with optional whitespace characters at the beginning and end of it.

    But I think filter_var with the correct flags is a much better and faster solution.

    See the time values at https://3v4l.org/FS5fJ

    • This topic was modified 3 years, 12 months ago by Anonymous User 17880307.
    • This topic was modified 3 years, 12 months ago by Anonymous User 17880307.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Use filter_var instead of preg_match (much better performance)’ is closed to new replies.