I have started building my code library since PHP 4. I have used require_once
to import classes. Now with PHP 5.3 I have met defining namespaces and importing them.
I would like to change my source files to use importing (use
statement) instead of using require_once
. Is this the right decision, I am not sure.
I guess it would be easy. Defining namespace at the top of class files and doing a search & replace on other files that use them (replace require_once
with use
). On practice what may go wrong?
And will there be performance improvement? On including file it is obvious how PHP finds the file. But on importing namespaces it is not that obvious. Is there a performance loss on searching namespaces and indexing them by PHP?