Damien Seguy
banner
dseguy.bsky.social
Damien Seguy
@dseguy.bsky.social
Code quality fanatic, static analysis expert @exakat, elephpant breeder, husband, father, speaker!
November 20th, 2025: PHP 8.5 arrives! 🐘

We’re throwing a release party at PHP Rotterdam, and you’re invited!

Expect PHPun, knowledge-sharing, and great company at Last Mile Solutions!

eventy.io/events/q8lmw...

#PHP #PHP85 #Community #Rotterdam #Developers
November 6, 2025 at 6:05 AM
It is easy to create a map from a list of object, using #PHP array_column() and the second argument null.

That null represents the whole object, and the third argument is the indexing key.

array_column($list_of_objects, null, 'id');

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
October 22, 2025 at 12:47 PM
It is not possible to cast any #PHP enum cases to (string) or (int) even when... they are backed!

That looks like a natural feature, though.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
October 2, 2025 at 8:28 PM
Dynamic class constants is achieved with #PHP 8.3 class constant syntax, and the constant() function.

It also applies to enumeration cases.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
October 1, 2025 at 8:52 PM
#PHP callable arrays are checked for 2 elements and only using index 0 and 1.

No one said that 0 and 1 have to be in that order, and it works perfectly!

Well done #PHP, well done!

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
September 21, 2025 at 5:06 PM
There are, at least, 4 ways to create a closure in #PHP. They all will be callable later.

On the other hand, they behave differently to check the underlying method.

All is in the timing.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
September 19, 2025 at 7:16 PM
A few days ago, I warned about isset() and a possible #PHP Fatal error.

Given that isset() and ?? share the same code, it is not suprising that ?? hold the same trap.

That bug should go away, the sooner the beter.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
September 18, 2025 at 8:16 PM
When using #PHP isset(), the language construct hides errors because, that's what is being tested there.

Unless there is an object, where an array is expected. Then, it leads to a fatal error.

It prevents the usage of an optimisation.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
September 15, 2025 at 6:50 PM
It is Friday, so why not cram as many #PHP operators in one single operation, and make it work?

Look at this beauty! Could you make it run?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
September 5, 2025 at 8:23 PM
A rare find: A syntax that worked before #PHP 8.1 and after #PHP 8.2 but not in #PHP 8.1

Here is the never arrow function.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
August 27, 2025 at 3:33 PM
So, take a #PHP array, but some value in it (like, anything).

Can you make an infinite loop out of this?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
July 3, 2025 at 6:12 PM
#PHP properties may be a reference.
#PHP properties may be promoted.
#PHP properties may have a hook.

Just not both at the same time.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
June 29, 2025 at 10:35 AM
In #PHP array_merge_recursive(), what is recursive?

Does it go deep in the guts of the arrays, or does it merges values that look alike?

Or something else?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
June 25, 2025 at 8:36 PM
Did you know that #PHP 's own $GLOBALS variable is actually undefined?

I'm going to miss the hedonism of those error messages once they are all fixed.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
June 22, 2025 at 7:40 PM
Since #PHP 8.4, we can have properties in interfaces!

Thank you, property hooks!

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
June 18, 2025 at 5:43 PM
The humble bitwise operators (& ^ | ) have a hidden secret : they work on integers and also on strings.

But not on both at the same time.

One of the earliest #PHP feature, still available 30 years later.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
June 16, 2025 at 7:55 PM
#PHP and Rotterdam is a love story. A huge crowd of PHP aficionados congregated to treehouse, to listen to Gina and eat cake. 
 
Home is where the elePHPant is.
June 13, 2025 at 7:22 PM
This one? Or the Powered by one?
June 11, 2025 at 8:24 PM
Who remember this? #PHP nostalgia
June 11, 2025 at 7:01 PM
#PHP recursive methods are easy, because they have a name.

What about closures? arrow functions?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
June 7, 2025 at 6:28 AM
#PHP can type arguments, properties and returns. But can it type also local variables ?

Well, it could, and for a long time.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
June 5, 2025 at 5:43 AM
C est toujours mon village préféré
June 1, 2025 at 7:19 AM
When using a referenced argument, the type is checked but it is not garanteed. After execution, it might be different than initialy.

Rare, but surprising.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
May 27, 2025 at 5:22 AM
May 12, 2025 at 7:34 PM
Sometimes, you'll find underscores in your HTTP variables, where you expected other characters, like +, . or space.

parse_str(), the underlying #PHP function, still enforce backward compatible behaviors.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...
May 12, 2025 at 7:18 PM