Damien Seguy's Avatar

Damien Seguy

@dseguy

Code quality fanatic, static analysis expert @exakat, elephpant breeder, husband, father, speaker!

650
Followers
234
Following
307
Posts
17.10.2023
Joined
Posts Following

Latest posts by Damien Seguy @dseguy

Les PHP, protecteurs de hautes personnalités Pour répondre à des sollicitations de plus en plus nombreuses, la FSP (Force Sécurité Protection du GIGN) peut compter sur les PHP (Protection de Haute Personnalité)...

#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...

06.03.2026 09:08 👍 3 🔁 0 💬 0 📌 0

What is the expected impact? 10% speed up of implode() calls?

03.03.2026 21:13 👍 1 🔁 0 💬 0 📌 0
<?php

const from = ['yield from'];

$a = fn () => yield yield from from;

foreach($a() as $b) {
    print $b;
}

<?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...

02.03.2026 00:36 👍 2 🔁 0 💬 0 📌 0

😂 good inspiration ideas …

27.02.2026 22:39 👍 0 🔁 0 💬 0 📌 0

Any 3v4l.org link to share?

27.02.2026 21:30 👍 0 🔁 0 💬 1 📌 0
<?php 
class X { 
    private array $code = []; 
    
    function foo() { 
        return (string) $this<-code; 
    } 
} 

var_dump((new X)->foo());

<?php class X { private array $code = []; function foo() { return (string) $this<-code; } } var_dump((new X)->foo());

Can you make this #PHP riddle running?

This compiles, so you can only add more code to make it work.

I asked 5 AI, 2 succeeded, 3 failed.

#phptip #phptrick

27.02.2026 15:15 👍 0 🔁 0 💬 1 📌 0
<?php

class x {
   const int|string A = 1, B = 'abc';
}

echo strlen(X::B);

<?php class x { const int|string A = 1, B = 'abc'; } echo strlen(X::B);

So, #PHP typed class constants are vaguely useful?

Here is a nice usage case that will definitely makes everyone love them.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...

25.02.2026 16:53 👍 0 🔁 0 💬 0 📌 0
Post image

#PHP numeric separator works well on integer, floats and also hexadecimals, octals and ... binary. And most useful in the latter, right?

0b1111_00_111_101_111

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...

19.02.2026 14:20 👍 0 🔁 0 💬 0 📌 0
Preview
Refactoring Strings to Enums - Exakat A journey to achieve Refactoring Strings to Enums: pre-requisite, unexpected consequences, and general recommendations.

Recap of a journey to refactor strings to #PHP enumerations, and some of the met challenges.

www.exakat.io/refactoring-...

15.02.2026 10:25 👍 1 🔁 0 💬 0 📌 0
<?php

echo 'B', 'A', sqrt(-1), 'A'; 

?>

<?php echo 'B', 'A', sqrt(-1), 'A'; ?>

What do you think this #PHP code will write?
Could we do better ?

#phptip #phptrick

cc @lecodeestdanslepre.fr 😉

php-tips.readthedocs.io/en/latest/ti...

11.02.2026 18:02 👍 2 🔁 1 💬 1 📌 0
Post image

En #PHP, ca marche aussi, mais en majuscules, et je dois reconnaitre que c'est moins élégant.

11.02.2026 09:17 👍 2 🔁 2 💬 1 📌 0

Now, we need more details. What, where, how?
Blog post?

09.02.2026 05:40 👍 0 🔁 0 💬 1 📌 0
Illustration de l'article

Illustration de l'article

L'EU Open Source Policy Summit 2026 se tiendra le 30 janvier à Bruxelles et en ligne pour échanger sur le rôle de l’Open Source dans la résilience numérique et la compétitivité européenne.

👉 data.europa.eu/en/ne...

26.01.2026 19:30 👍 4 🔁 4 💬 0 📌 0
<?php

$string = '123a';
$integer = -$string; // warning!

<?php $string = '123a'; $integer = -$string; // warning!

What if you want to convert a #PHP string to the opposite number ? Can you cast (int) and use minus?

Well, can you?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...

25.01.2026 15:36 👍 3 🔁 0 💬 1 📌 0
<?php

function foo() {
    print_r(func_get_args());
}

$array = [1,2,3];

// Not possible
// cannot use positional argument after unpacking
//foo(...$array, ...$array, 4);

foo(...$array, ...$array, ...[4]);

<?php function foo() { print_r(func_get_args()); } $array = [1,2,3]; // Not possible // cannot use positional argument after unpacking //foo(...$array, ...$array, 4); foo(...$array, ...$array, ...[4]);

So, ...[4] means unpacking a single value from a #PHP array.
This basically means reading the value itself.

Unless it is useful sometimes...

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...

22.01.2026 07:28 👍 1 🔁 0 💬 0 📌 0
Post image

Closure, constant, #PHP 8.5, parenthesis, ants and cast: what could go wrong, right?

php-tips.readthedocs.io/en/latest/ti...

#phptip #phptrick

21.01.2026 10:18 👍 1 🔁 0 💬 0 📌 0
Post image

TIL that it is possible to use cast, like (int) or (string) with constants, since #PHP 8.5.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...

20.01.2026 18:00 👍 0 🔁 0 💬 0 📌 0
Preview
Meetup Janvier - Damien Seguy, Thu, Jan 29, 2026, 6:30 PM | Meetup Bonjour à tous ! Non vous ne rêvez pas ! Un événement tech aura bien lieu à Limoges ! C'est du last minutes mais nous profitons de la venue de Damien Seguy dans nos contr

Je serai de passage à l' @afup.org Limoges, jeudi 29 janvier 2026.

Rendez-vous chez OD&B, pour améliorer son code aujourd'hui et être prêt pour #PHP9 demain!

Les elePHPants sont les bienvenus!

www.meetup.com/afup-limoges...

19.01.2026 11:18 👍 0 🔁 0 💬 0 📌 0

Are telling everyone that I am more than 100 years old? Ssshhhhh!

16.01.2026 08:39 👍 0 🔁 0 💬 0 📌 0
Post image

The global keyword imports variables from the outside, and overwrites the local value. Beware, when using it.

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...

15.01.2026 17:45 👍 0 🔁 0 💬 1 📌 0

Thanks for your work!

15.01.2026 14:07 👍 1 🔁 0 💬 0 📌 0
Post image

I just started the vote on my latest #PHP RFC to improve pack() and unpack() functions. It targets the next version, likely 8.6 as I'm writing this.

Fingers crossed! 🤞

wiki.php.net/rfc/pack-unp...

14.01.2026 15:09 👍 4 🔁 1 💬 1 📌 0
Merry Christmas! FrankenPHP 1.11: Hot Reload, Structured Logging, and More Speed - Kévin Dunglas Ho ho ho! 🎅 I’m thrilled to announce the immediate availability of FrankenPHP 1.11! We have a special gift for the PHP community to unwrap this Christmas Eve. This release is laser-focused on improvin...

Mea culpa, this is too early !

dunglas.dev/2025/12/merr...

14.01.2026 20:40 👍 0 🔁 0 💬 0 📌 0
Post image

ElePHPant alert : Le Monstre, from #frankenphp is available on the shop. Normal or big.

lemonstre.frankenphp.dev

14.01.2026 16:16 👍 0 🔁 0 💬 1 📌 0
Preview
Convert a string to integer with PHP - Exakat How to Convert a string to integer with PHP: since PHP 8.5, there is a warning for larger than integer strings, so how do you do it?

Converting a string to an int, without a warning.

A PHP 8.5 challenge.

#phptip #phptrick

www.exakat.io/convert-a-st...

14.01.2026 05:47 👍 1 🔁 0 💬 0 📌 0
Apéro PHP mercredi 17 décembre dès 18h chez Hopi

Apéro PHP mercredi 17 décembre dès 18h chez Hopi

Devs de Lille et des environs, rejoignez la communauté ce soir au Bar Hôpi pour un dernier verre avec l'AFUP Hauts-de-France avant la nouvelle année ! Il est encore temps de vous inscrire pour une soirée en bonne compagnie.
buff.ly/L7yJmWw

17.12.2025 10:16 👍 1 🔁 1 💬 0 📌 0
<?php

class X {
  // Some magic happen here
}

X::foo();
(new x)->foo();

<?php class X { // Some magic happen here } X::foo(); (new x)->foo();

Can a #PHP class have two methods with the same name?

Not with signature overloading, a classic feature, right?
But rather one method static and the other one non-static?

#phptip #phptrick

php-tips.readthedocs.io/en/latest/ti...

15.12.2025 10:22 👍 1 🔁 0 💬 0 📌 0
Post image

C'est le deuxième jour de @osxp2023.bsky.social et on parle de tout #php #drupal #firefox #commonvoire... et vous me trouverez sur le stand @drupal.fr @mozilla-fr.bsky.social au village associatif

11.12.2025 05:39 👍 2 🔁 3 💬 0 📌 0
<?php

echo intval('1AZ') .PHP_EOL; // 1
echo intval('1AZ', 11).PHP_EOL; // 21
echo intval('1AZ', 21).PHP_EOL; // 31
echo intval('1AZ', 36).PHP_EOL; // 1691
echo intval('1AZ', 37).PHP_EOL; // 0

echo intval( 123, 11).PHP_EOL; // 123
echo intval('123', 11).PHP_EOL; // 246

<?php echo intval('1AZ') .PHP_EOL; // 1 echo intval('1AZ', 11).PHP_EOL; // 21 echo intval('1AZ', 21).PHP_EOL; // 31 echo intval('1AZ', 36).PHP_EOL; // 1691 echo intval('1AZ', 37).PHP_EOL; // 0 echo intval( 123, 11).PHP_EOL; // 123 echo intval('123', 11).PHP_EOL; // 246

Do you think that intval() is a boring #PHP native function that turns string into integers?

Well, it does, but it is not boring. Far from it!

php-tips.readthedocs.io/en/latest/ti...

#phptip #phptrick

08.12.2025 20:43 👍 2 🔁 0 💬 0 📌 0
Preview
PHP Dev Squad | daily.dev Welcome to PHP Dev, a dedicated space for sharing knowledge about PHP and its ecosystem (only PHP directly related). Help us find good articles and blogposts and provide links. Upvote or downvote, aft...

Interesting #PHP news and articles on @dailydev.bsky.social : the PHPDev squad.

See you there!

app.daily.dev/squads/phpdev

08.12.2025 19:53 👍 2 🔁 1 💬 0 📌 0