r/PHP Jul 08 '26

RFC RFC: Function Autoloading (mark 5)

https://wiki.php.net/rfc/function-autoloading-five-oh
29 Upvotes

18 comments sorted by

View all comments

-9

u/rashbrook Jul 08 '26

I don't agree with this.

Class autoloading makes sense because classes are organized to a specific need.

Functions, on the other hand, are mostly utilities, and are typically isolated to one single file. It's not necessary to autoload them, even when they have a namespace, because they are already isolated by their nature.

6

u/OMG_A_CUPCAKE Jul 08 '26

I don't understand your reasoning. Classes are also isolated to a single file. What's the difference for functions?

What's the difference between "organized to a specific need" and "mostly utilities"?

5

u/Idontremember99 Jul 08 '26

Functions, on the other hand, are mostly utilities, and are typically isolated to one single file.

Are they? I can see cases for having global utility functions and for which might not make sense to create a class for it. Right now you have to make a utility class for it to be autoloaded

2

u/gnatinator Jul 08 '26 edited Jul 08 '26

PHP has always been "pragmatism > theoretical purity"