well, you can make a function for all your database actions... like database('query',$query); and the readability is **** because you put all your classes in one file...
...and there is only 2 ways you are getting variables into those functions: including them as globals, or passing them into the function, like database($credentials, $type, $qry). And everytime you need to pass a query you repeat that...if you include them as globals, you have to jump out of the function and refer back to where ever you included the variable at
i don't really understand what you mean by saying that it's hard to read functions...
I said they can get hard to follow...if you use an IDE to program, the IDE (just like the PHP parser) will automatically isolate the variables and functions within the class you are working in. Using libraries of included function files, the editor will include all functions regardless of relevance or naming convention I use on the files.
Take, for example, the task is to query a database and display the results in an HTML table:
$qry = new dbQry($db_creds);
$qry->set_qry('SELECT * FROM contacts');
$contact_tbl = $qry->output_result('tbl');
// Then within the same instance of the class, I could get another table of info without having to pass the params again
$qry->set_qry('SELECT * FROM products');
$product_tbl = $qry->output_result('tbl');
This is a very readable way to aquire 2 (or more) full HTML tables of database results. IF there is a problem in the class, the IDE will take me there and only show relevant functions and variables...furthermore the modularity has 2 benefits:
I can drop that class into any app I work on
I can give that class to someone else to contribute to, modify or enhance, without concern of missing other dependant files or conflicting functions.
if they're in different files, there's much less scrolling to do...you just open the file you need and it has about 100 lines... i think it's much better than having one file with 5000 lines... you'll spend 10 minutes scrolling and you'll probably forget what you were searching for xD. oh and use notepad++ or other tabbed text editor...
Again, this assumes you program in a text editor. An IDE like PHPStorm, or NetBeans...or even Geany (if you wanna be free and mimalist) will really help you not have to focus so much on your own filing system.
I think the biggest things to consider in functions vs classes is 1) The size, function and speed at which you can create app...and 2) Whether you are in a collaborative environment. IF you are the only one working on the code for personal use, use any system you like...but if you are in a collaborative environment, there is no way you will get agreement on a filing system for includes, and the program's "tasks" are usually divided among developers...But the great thing about PHP is that it allows that flexibility to decide what the best approach will be in each situation.