Re: Includes vs. Functions

From: Date: Wed, 17 Jul 2002 21:05:59 +0000
Subject: Re: Includes vs. Functions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-108168@lists.php.net to get a copy of this message
I am not sure about efficiency, myself and I often ask this without much if anything at all for a response. However, I am the opposite of you, in that I prefer to create a library file containing all the functions. To make developing the page in something like Dreamweaver or Frontpage easier, I global all the variables of a given function, like say Function StockQuote($sym) { }. They I include the library file in my PHP webpage.Something like this... <html> <head> ~blah </head> <body> <?PHP include("filepath/filename"); StockQuote($sym); ?> various html ~blah ~blah <?PHP print $Stock_LastPrice; ?> ~blah ~blah </body> </html> In the library file, I global the variables; function StockQuote($sym) { global $Stock_LastPrice, $Stock_Position; get the data... do something with the data... $Stock_LastPrice = This minus that blah blah; } I can use this variable anywhere I would like and it is very WYSIWYG friendly. I am not sure how efficient it is though as I mentioned above. "Monty" <monty3@hotmail.com> wrote in message news:B95B4CA8.11721%monty3@hotmail.com... > I generally prefer to include various blocks of code in templates using > include_once() rather than load a functions library and make calls to those > functions within the script. > > Is there a big difference in efficiency and speed of includes vs. custom > functions? I like includes because it's easier to drop blocks of code in a > page design without disrupting the design of the page very much. > > Thanks, > > Monty >

« previous php.general (#108168) next »