What is good way:
Keep all functions in one file or to set apart them? (like database.php, session.php)
What is good way: Keep all functions in one file or to set apart
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
My approach is split functionalities into classes; and then to put each class into one file.
If you have a lot of functions, I would do the same – split them into thematically separate files and include them only when needed.
If you work with classes, you can make use of PHP’s autoloader functionality that will automatically load any PHP files needed to instantiate a certain class.