r/phpstorm • u/RequirementWeird5517 • Sep 18 '26
blog In PHP, Loading a File Means Running It
/r/PHP/comments/1wjn1gx/in_php_loading_a_file_means_running_it/
2
Upvotes
r/phpstorm • u/RequirementWeird5517 • Sep 18 '26
4
u/TinyLebowski Sep 18 '26
My sweet summer child 😜
I'm actually happy that this isn't common knowledge anymore. I take it as a sign of how far PHP has come. Learning about those gotchas was inevitable back in the day, because we did a lot of manual includes.
3
u/nvahalik Sep 18 '26
20-some odd years ago I got pulled into a PHP project. I was tasked with trying to figure out why it was so slow. It was written in PHP. The folks said "it worked, but it was basically unusably slow". I don't remember which version of PHP exactly, but it was way before 7.
Anyway. The reason why it was so slow? There were no functions. Everything was global state + include()d files. Includes were basically treated like function calls.
I learned something new that day!