Re: functions versus includes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Frank Lopes wrote:
I just started using PHP and got to think...

Without getting into the discussion of "best practices", strictly from a performance perspective,
what is faster: a function or an include?

For example I have a block of text that needs to appear mutliple times throughout the site.

Will I be better off creating a function with its contents and then later just calling the function or, will it be faster (from an execution perspective) for me to create an .inc file that gets included later on?

Micro-optimization is pretty useless. I seriously doubt you would notice any difference in performance.

This comes under the other discussions like about which is faster - a foreach/while/for loop.

You'll find other bottlenecks (eg changing a regex to do an str_replace) which will make a bigger difference.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux