zero-perfoliate
zero-perfoliate

Author Topic: php functions vs performance  (Read 240 times)

Offline minerbog

  • New PHP Members
  • Posts: 1
  • Karma: +0/-0
php functions vs performance
« on: February 10, 2010, 01:33:55 AM »
Hi All,

Its my first day here so please be gentle!

My site is now getting very, shall we say difficult to read! A lot of the code is repeated so I want to put them into reusable functions. My question is though, if I say, have an include called security that has 12 functions in it and in a particular page I only need to use 1 function, does that fact the other 11 are there impact on performance? I.E. are they read even though they are never called?

Many Thanks

Gavin.

hotnoob

  • Guest
Re: php functions vs performance
« Reply #1 on: February 10, 2010, 07:49:17 PM »
im not 100% sure about this... but if you are only using the function once.. than it will be slightly slower... but if you are using that 1 function, lets say 6 or so times, than yes it probably is faster.

However, the time difference is like "microscopic"

Anyway, i might be wrong... so...
this post: http://phpbar.isgreat.org/viewtopic.php?f=2&t=43

will tell you how to test your scripts performance, than you can compare the 2 different versions to see which works better.

Personally, though... what ever works best for you is better...
however, if you are thinking about not using functions... than it will be a lot more difficult to make changes to your programing in the future.

Here is a little article on making web designing easier with the help of php: http://phpbar.isgreat.org/viewtopic.php?f=2&t=42

Well... hope i helped :D



 

zero-perfoliate