4 ms·
Are you sure? I've definitely written a `use` statement to import a function. https://www.php.net/manual/en/language.namespaces.importing.php https://www.php.n
by yurishimo 4y ago
Are you sure? I've definitely written a `use` statement to import a function.
https://www.php.net/manual/en/language.namespaces.importing.php https://www.php.net/manual/en/language.namespaces.importing....
- morelisp 4y agoAFAIK this only works if the function has already been loaded for some other reason (i.e. in the same file as a class or an explicit require). I do cop to not having used PHP recently, so maybe 8 fixed it? At least in the PHP I'm familiar with, nothing "happens" at `use` time; the first time you call a method on a class it autoloads. The autoloader is then what does the work of finding and requiring the file. No class, no autoloader.
- porker 4y agoPHP 8 hasn't fixed function autoloading, and Composer still has hacks like you can specify function containing files it will always load.