Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is a .php file too large? [closed]

Tags:

php

apache

I'm writing a PHP class. At the moment there are 1,000 lines of code and the file size is 46 KB. It's not an insane size, but this got me to thinking.

Q: At what point would performance start to be affected due to file size and/or the amount of code included in the PHP file?

like image 358
Adam Avatar asked Feb 17 '23 09:02

Adam


1 Answers

For php there is no noticeable difference (especially if you use any opcode cache) if there is 10 files each 100 lines or 1 with 1000 lines.

But from maintainability point of view it would be better to split the class responsibilities to several.

like image 60
zerkms Avatar answered Feb 23 '23 11:02

zerkms