Skip to main content

First-Class Callable Syntax

PHP 8.1 introduced strtoupper(…) — a syntactically clean way to reference a function as a callable. Same for methods: $user->email(…).It replaces the older string-or-array c…

April 13, 2026 PHP chris 1 min read Architecture

Article takeaway

PHP 8.1 introduced strtoupper(...) — a syntactically clean way to reference a function as a callable. Same for methods: $user->email(...).It replaces the older string-or-array c…

PHP 8.1 introduced strtoupper(...) — a syntactically clean way to reference a function as a callable. Same for methods: $user->email(...).

It replaces the older string-or-array callable forms with a syntax that static analysers can verify. array_map(strtoupper(...), $names) is now safe.

The Closure created is bindable, callable, and importable — better in every way than the legacy 'strtoupper' form.

Share X / Twitter LinkedIn

Leave a comment

Related Posts