Re: RFC: blank() Function as a Complement to empty()
| From: | Tim Düsterhus | Date: | Thu, 17 Apr 2025 07:59:06 +0000 |
| Subject: | Re: RFC: blank() Function as a Complement to empty() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127128@lists.php.net to get a copy of this message | ||
Hi
Am 2025-04-07 09:14, schrieb Rowan Tommins [IMSoP]:
I think a function for "string is zero length or contains only whitespace" would potentially be usefulAnd for that one it would need to be defined what whitespace is. Is it just the ASCII whitespace characters? Is it Unicode whitespace? Is it also Unicode non-whitespace that renders as blank? To give an example of the complexity here, this is a
trim() function that I implemented to handle all kinds of “blank input abuse”, while trying not to break legitimate use-cases of non-Latin languages:
https://github.com/WoltLab/WCF/blob/5c6568807aa22ce337e7527f75c7a8fb2047bf67/wcfsetup/install/files/lib/util/StringUtil.class.php#L90-L141
Best regards
Tim Düsterhus