whitespace Syndicate content

» PHP "is_whitespace" performance

Fri, 08/22/2008 - 00:09

Easy question: What is the fastest way to determine if a string in PHP is whitespace-only?

Easy answer: !preg_match('[^\s]', $string);

Read on for the explanation: