I'm trying to build up my knowledge of OOP in PHP. Every suggestion I've read says that "all php classes should be stored inside a separate file than the index.php file". One went as far as to say
"You would never create your PHP classes directly inside your main php pages - that would defeat one of the purposes of object oriented PHP in the first place!"
I'm trying to work out why that is.
I understand that flicking through many lines of code in a single file isn't to everyone's taste. However, I've always preferred to load all my functions in to different sections of the same file as much as possible. I haven't found any problems associated with this before so I'm not sure why convention is to hold all functions elsewhere.
My question is: Is this just a convention, or is there another specific benefit to organising files in this way when using OOP?
This question arises because I built a heavily function based (but not class based - as I'm learning) project with over 150k lines of code that draws on php libraries and the db connection file but nothing else. That project includes various modules that I use to template / construct new projects, and I'm fond of it. I want to bring it up to date with the latest standards, but unless there is a real benefit to restructuring the files, I'm not sure it is worth it.