And this is not a PHP integer, because, even as it is an integer initially, it goes beyond the PHP_INT_MAX, which is signed. So, it ends as a float, or a string.

So, this is all logical, but also, quite surprising.

#phptip #phptrick

Yield or return, when using ... in a function call?

Not an easy question to ask on a first date.

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/yield_or_return.html

Passing array by value, and updating its elements.

Nothing new, it is the readonly and array_fill() syndrom for arrays. Better know about it.

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/array_by_value.html

#PHP quiz of the day: how can a property be both not set, empty() and failing at comparison with falsy value?

And more than one of us has this bug ATM.

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/not_set_but_exists.html

New word: zombie closure

That is when you put $this in a static closure, you can run the #PHP code but you can't call it.

Just a reminder about static arrow functions.

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/static_arrow_function.html

#PHP defined() in action: there are many aspects when checking for a constant existence.

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/defined.html

preg_split() splits #PHP strings with regexes, captures the separators and can handle an empty regex.

You don't need that everyday, but when you do, #PHP has it!

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/preg_split.html

#[ReturnTypeWillChange] works on native #PHP methods and also on custom ones.

#phptrick #phptip

https://php-tips.readthedocs.io/en/latest/tips/returntypewillchange_for_all.html

ReturnTypeWillChange Is For All

``ReturnTypeWillChange`` is an attribute that tells PHP that the return type of the related method is different from the defined by the PHP native methods

#PHP's NAN is 0 as an integer, 'NAN' as a string and not comparable with itself.

Also, there are now warning when using them, so no one can get hurt by this.

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/compare_nan.html

Enumerations are backed by strings, they work with in_array(), but not with array_unique()

Well, at least, not directly.

Also, did you know Enum::cases() ?

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/array_unique_and_enum.html