Namespaced functions in PHP
? When calling a function, #PHP will first look for one in the current namespace before calling the global one. pic.twitter.com/qYh6o9eypZ
— Freek Van der Herten (@freekmurze) October 17, 2019
Read more [twitter.com]
Posts tagged with namespaces
? When calling a function, #PHP will first look for one in the current namespace before calling the global one. pic.twitter.com/qYh6o9eypZ
— Freek Van der Herten (@freekmurze) October 17, 2019
Read more [twitter.com]
Rob Allen performs a cool test.
Recently I needed to test part of Slim that uses the built-in PHP functions header() and headers_sent(). To do this, I took advantage of PHP’s namespace resolution rules where it will find a function within the same namespace first before finding one with the same name in the global namespace.
Read more [akrabat.com]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"Freek’s newsletter is one of the best ways to stay updated with the Laravel and PHP ecosystem. It consistently highlights useful packages, tools, and ideas from the community, especially the amazing work coming from Spatie. As a Laravel developer building SaaS and web platforms, I find it extremely helpful to discover practical tools and insights that improve my development workflow."
A fully qualified function name is a little bit faster than a non-qualified one. Toon Verwerft explains it all in his lastest blogpost.
Today, a little conversation on Twitter escalated rather quickly. Apparently PHP runs function calls differently depending on namespaced or non namespaced context. When calling functions in a namespaced context, additional actions are triggered in PHP which result in slower execution. In this article, I'll explain what happens and how you can speed up your application.
http://veewee.github.io/blog/optimizing-php-performance-by-fq-function-calls/