#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
php-tips.readthedocs.io/en/latest/ti...
Posts by Damien Seguy
#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
php-tips.readthedocs.io/en/latest/ti...
Any detailled thoughts about the cleaner code with property hooks? I tend to agree, thought I feel the impact more than I see it.
I added the second situation from your code here: It makes the example long, but still readable.
3v4l.org/2nPL6
Also, I tried with promoted properties, and it has no impact: so different behavior. Geez... #PHP ...
3v4l.org/E6G8f#veol
I always thought that the order of properties in a #PHP class didn't matter, but that's not true. It does matter when comparing two instances of the same class. Each property is evaluated one after another in the order they were declared until the first difference is found. 3v4l.org/NTP5c
#PHP news: lemmy.world/c/php?dataTy...
header_register_callback() registers a function that fires just before headers are sent.
After ALL your code runs. After ALL output buffering. Before the first byte goes to the client.
Last chance to add headers, and last chance to change the status code!
There is no later hook in #PHP than this.
All #PHP developers should watch this talk by @dseguy.bsky.social to prepare their codebases for the future
youtu.be/T5wQn57Zhkw?...
Gagne ta place pour l'@afup.org Day 2026 ! 🥳
L'événement a lieu à Bordeaux, Lyon et Lille, vendredi 22 mai !
Pour jouer :
- Rejoins notre Discord : humancoders.com/pages/discord
- Précise la ville pour laquelle tu participes
- Les gagnant·e·s seront annoncé·e·s sur Discord le 24 avril
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
php-tips.readthedocs.io/en/latest/ti...
I’m always moved when a young elePHPant meets Trisaieul, the great grand parent of all elephpants.
Thanks Tideways for making this reunion possible.
Moni: welcome to the PHPamily!
#PHP defined() in action: there are many aspects when checking for a constant existence.
#phptip #phptrick
php-tips.readthedocs.io/en/latest/ti...
We are very happy to welcome Matt Stauffer as the newest Board member for The PHP Foundation! Matt brings decades of experience and we are grateful for his insight as we move forward.
Welcome, Matt! 🤩 🐘 🚀
Read more: thephp.foundation/blog/2026/03...
#php #thephpfoundation #phpc
Et fait des encoches à gauche pour les rendre double face?
3 strategies to rename parameters in a #PHP method
www.exakat.io/renaming-par...
I owe this one to @faguo!
In #PHP, expm1() computes exp(x) - 1.
log1p() computes log(1 + x).
"Why not just write exp($x) - 1" you may ask...
Because when x is close to 0, floating point eats your precision alive. Think about it if you deal with finance!
I've published a new blog post: "Human Creations", on the difference in content generation by LLMs, and the creation of text, art and code by humans.
You can find it at https://derickrethans.nl/human-creations.html or at @blog
#writing #ai #content #fediverse #MadeByHumans
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
php-tips.readthedocs.io/en/latest/ti...
Current #PHP RFCs in voting phases (March 2026)
See what will come to #PHP 8.6
www.exakat.io/current-php-...
#[ReturnTypeWillChange] works on native #PHP methods and also on custom ones.
#phptrick #phptip
php-tips.readthedocs.io/en/latest/ti...
#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
php-tips.readthedocs.io/en/latest/ti...
What kind of PHP developer are you? 🤔
#PHP, Protecteurs de Hautes Personnalités,
carrément sur le site du ministère de l'intérieur.
www.gendarmerie.interieur.gouv.fr/gendinfo/dos...
What is the expected impact? 10% speed up of implode() calls?
<?php const from = ['yield from']; $a = fn () => yield yield from from; foreach($a() as $b) { print $b; }
OK, I'm tired and this #PHP make me chuckle.
#phptip #phptrick
php-tips.readthedocs.io/en/latest/ti...
😂 good inspiration ideas …
Any 3v4l.org link to share?