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 useful
And for that one it would need to be defined what whitespace is. Is it
just the ASCII whitespace characters? Is it Unicode whitespace?
>If this can still be implemented in userland you don't need logic integrated
>at low level
Afaik it cannot be implemented in userland today.
The closest you can get today is to use reference hacks, which
introduce side-effects, like if you do
function blank(&$value){...}
blank($_POST['foo'])
an
On 5 April 2025 21:00:15 BST, Rob Landers wrote:
>I agree with most of these. I do not agree that " " (a space) is blank though.
>For people without last names, this is often their last name to pass
>validation on forms.
This is firmly into "space-bar heating" [https://xkcd.com/1172/] terr
On Sun, Apr 6, 2025 at 9:52 AM Hans Henrik Bergan
wrote:
> Maybe a
> #[\SuppressUndefinedWarning]
>
> Parameter attribute could work, then everyone could implement their own
> blank() function with their own preferred logic
>
> Not sure if it's technically feasible tho, now the php engine would n
Maybe a
#[\SuppressUndefinedWarning]
Parameter attribute could work, then everyone could implement their own
blank() function with their own preferred logic
Not sure if it's technically feasible tho, now the php engine would need to
inspect the parameter attributes before deciding on generating a
On Sat, Apr 5, 2025 at 11:04 PM Rob Landers wrote:
> On Sat, Apr 5, 2025, at 14:15, Kayck Matias wrote:
>
> *INTRODUCTION*
> This RFC proposes the addition of a new global function blank() to PHP’s
> core, intended to provide a more intuitive and context-sensitive way of
> checking for "blank" va
On Sat, Apr 5, 2025, at 14:15, Kayck Matias wrote:
> *INTRODUCTION*
> This RFC proposes the addition of a new global function `blank()` to PHP’s
> core, intended to provide a more intuitive and context-sensitive way of
> checking for "blank" values. This function is *not a replacement* for
> `em
On Sat, Apr 5, 2025, at 21:23, Bilge wrote:
> On 05/04/2025 20:18, Rob Landers wrote:
>> On Sat, Apr 5, 2025, at 21:10, Bilge wrote:
>>> On 05/04/2025 19:41, Rob Landers wrote:
empty() has very many uses.
>>> That is exactly the same as saying `==` has many uses. It does. So many
>>> uses t
On 05/04/2025 20:18, Rob Landers wrote:
On Sat, Apr 5, 2025, at 21:10, Bilge wrote:
On 05/04/2025 19:41, Rob Landers wrote:
empty() has very many uses.
That is exactly the same as saying `==` has many uses. It does. So
many uses that it's useless. Its semantics are nonsense.
if (isset($var)
On Sat, Apr 5, 2025, at 21:10, Bilge wrote:
> On 05/04/2025 19:41, Rob Landers wrote:
>> empty() has very many uses.
> That is exactly the same as saying `==` has many uses. It does. So many uses
> that it's useless. Its semantics are nonsense.
>>
>> if (isset($var) && $varl != false) {
>> foo(
On 05/04/2025 19:41, Rob Landers wrote:
empty() has very many uses.
That is exactly the same as saying `==` has many uses. It does. So many
uses that it's useless. Its semantics are nonsense.
if (isset($var) && $varl != false) {
foo($bool);
}
>$varl != false
You should never be doing this
> echo blank(" "); // true
This case is not blank `empty` checks if a variable is set and contains
something so basically what your blank function does. In this example it
contains character 32. If you want to remove the "\0" (null terminator)
from the language, that's a different story.
On Sat,
On Sat, Apr 5, 2025, at 20:25, Bilge wrote:
> On 05/04/2025 15:32, Kamil Tekiela wrote:
> >
> > While it has its uses empty() should be avoided whenever possible.
> >
> Agree. A better RFC would be to just deprecate `empty()`.
>
> Cheers,
> Bilge
>
empty() has very many uses. Once you understand
On 05/04/2025 15:32, Kamil Tekiela wrote:
While it has its uses empty() should be avoided whenever possible.
Agree. A better RFC would be to just deprecate `empty()`.
Cheers,
Bilge
Hi Kayck,
Thanks for your proposal. Here are some points from me:
empty() is not a function, it's a language construct that's a shorthand for
!isset($var) || $var == false.
While it has its uses empty() should be avoided whenever possible. It's
generally a sign of the programmer being lazy not d
15 matches
Mail list logo