[PHP] functions versus includes

2007-11-11 Thread Frank Lopes

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?


Thanks for the your thoughts. 


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



[PHP] PHP editor

2007-11-11 Thread Frank Lopes
Being very new to PHP (empahsis on VERY...), I wonder what most of you use 
to develop in PHP?


I have experimented with DreamWeaver, UltraEdit, phoDesigner, Eclipse etc.

What would you recommend that I use?

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



[PHP] Re: functions versus includes

2007-11-11 Thread Frank Lopes

No takers on this topic?


""Frank Lopes"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

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?


Thanks for the your thoughts. 


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



Re: [PHP] Re: functions versus includes

2007-11-14 Thread Frank Lopes

<>

Stut,

You pointed me in the right direction, thank you.


"Stut" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Frank Lopes wrote:

No takers on this topic?


The question is not one of performance since while it will be quicker to 
call a function than include a file the difference is going to be 
inconsequential.


If you were to use a function where would you put it? You imply it needs 
to be used from multiple scripts, so it would need to be in an included 
file anyway which makes the question kinda pointless.


Whether to use a function should then be based on how you need to use this 
"block of text". Will it be used more than once in any given script? If 
yes then you want a function so you only need to include the file once. If 
not then it really doesn't matter whether you use a function in the 
external file.


When you're thinking about possible performance issues there are two 
things you need to ensure...


1) You're not spending time optimising the wrong bit (this would be an 
example of that). You can check that by writing a quick performance test 
as someone did later in this thread. 90% of the time you'll find that the 
performance difference between two options is negligible.


2) The architecture and maintainability of your code is more important 
than most performance issues you can imagine.


Performance optimisation should be driven by performance problems. Write 
your app, test it, find bottlenecks and then optimise those. Time spent 
saving 0.001 seconds per request is better spent elsewhere.


-Stut

--
http://stut.net/

""Frank Lopes"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

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?


Thanks for the your thoughts.




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