Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have too many functions in a PHP application?

Tags:

function

php

Can a PHP application have too many functions? Does the execution of a large number of PHP functions hog memory and resources? My WordPress theme in-development has a lot of functions (probably more than 100 by the time I'm done) and I'm concerned that I might have too many.

like image 982
orbit82 Avatar asked Jun 11 '10 05:06

orbit82


2 Answers

Even if many functions led to more memory consumption, I'd advise you to use them anyway. A clear structure is much more important than performance.

Performance can be improved by throwing hardware at it, a badly structure application gets quickly very hard to maintain.

By the way: 100 functions are nothing!

like image 172
Georg Schölly Avatar answered Oct 12 '22 23:10

Georg Schölly


100 functions is nothing to worry about. If your code is slow you should profile it to explicitly find the slow parts.

Remember, premature optimizations are evil

like image 44
Mad Scientist Avatar answered Oct 12 '22 22:10

Mad Scientist