Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I understand that in normal php if we're including a file we're merging the source of it in the script and it would take longer for that page to be parsed/processed but if we're using HipHop shouldn't it be ok to just create one single php file and include every file in it (that contains some class) and every page which needs those classes (in separate file each) can just include one single php file?

Would this be ok in presence of HipHop?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Correct way to handle this situation is using spl_autoload_register method to register your custom method that will be invoked every time a class is used in your file which is not yet declared.

In the implementation of this method you can do a dynamic include based on the class name. It is also supported in HipHop

http://www.php.net/manual/en/function.spl-autoload-register.php

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.