Five Ways to Write a PHP Type

Five Ways to Write a PHP Type PHP’s type system is grown up. PHP 7.0 started the ball rolling with parameter and return types. PHP 7.4 added property types. PHP 8.3 added the class constant types, though we’ll omit this for now. PHP has quietly accumulated five distinct syntaxes where you can write something that […]

PHP and AI: What Actually Exists at the Language Level

Elephpant and AI

PHP and AI: What Actually Exists at the Language Level PHP runs about three-quarters of the web, and yet whenever AI comes up in conversation, PHP is the friend who wasn’t invited to the party. The received wisdom is that AI belongs to Python and that PHP developers are limited to politely calling someone else’s […]

1-2-3 PHP operators

1-2-3 PHP operators I learnt my PHP on a European keyboard, and it was always a pain to use some strange symbols. When I moved to Canada, I quickly realized that the chosen symbols were actually very easily accessible on the keyboard: it was just my layout that was less practical. Then, I also realized […]

PHP 8 Attribute usage in 2023

PHP 8 attributes in 2023 PHP 8 introduced the attributes, in lieu of the phpdoc comments. They may be added to classes, methods, functions, parameters, properties and class constants and provide a PHP-way to write custom configurations. This is a way to provide contextual information inside the code, and make it available to the PHP […]

I scream, you scream, we all scream for @ no scream operator

I scream, you scream, we all scream for @ @, no scream operator, is a classic PHP operator, meant to suppress error displays locally. It is a staple of PHP code, in use in over 65% of PHP repositories : 2 repositories out of 3. Yet, it is widely recommended avoiding using it. Indeed, are […]