Re: PHP Script Speed

From: Date: Tue, 09 Jul 2002 04:40:25 +0000
Subject: Re: PHP Script Speed
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-106172@lists.php.net to get a copy of this message
I understand what you're getting at, I'm not sure of the answer though. I know it would stop you using FrontPage or Dreamweaver but if for example you had <?PHP print "<HTML><HEAD><TITLE>Index page</TITLE></HEAD><BODY>"; print "<P>Current: $_Current</P>"; print "<P>Percent Change: $_ChangePercent</P>"; print "</BODY></HTML>"; ?> You'd eliminate that problem. "Christopher Crane" <CCrane@IKON.com> wrote in message news:91D948A579ADD4118F7900D0B7B9E3C307B8D25C@hfd01-msx-03.ikon.org... > I have a question on speed but also dealing with the method of scripting. > I have a few pages where I get things like weather and stocks. I get the > data, which is usually in the form of a Comma delimited string like the > stock quotes from Yahoo.com. In the past, I also wrote a function to get the > data and split into variables like $S_Current, $S_ChangePercent, > $S_ChangeDollar ect.... Then I would print out a whole HTML table with the > variables embedded within. This function was called from a PHP type web > page. Lately, I have been making the variables global and using them when I > need them. For instance, I have a page called index.php. At the stock > section of the page, I have a function that is called and returns the major > indices, like NASDAQ, DOW and S&P. I global the variables and then within > the index.php page I called the variables as I need them in tables. This > makes designing the page simple. I can do it in Frontpage or Dreamweaver or > whatever. The old way was to call the function and the function would print > out the HTML table as part of the function. > > I hope I am explaining this well enough to understand. Doing it the newer > way for me with the global variables makes it easier to design the web page, > but I am wondering if it is at the cost of a slower page loading. The reason > I think this is whenever I would like to display a variable I have to put in > a script tag like <?PHP print $S_Current; ?>. I might have as many as 20 of > these on a page. Every time doesn't PHP have to start again and parse out > this information causing it to be really slow? > > The old way was for me to call the function like <?PHP indices(); ?> and > then the function would print out; > <table> > <tr> > <td>Dow</td> > <td>NASDAQ</td> > <td>S & P</td> > </tr> > <tr> > <td>$Dow_Current<img src=\"img\up.gif\"></td> > <td>$Nas_Current<img src=\"img\up.gif\"></td> > <td>$Snp_Current<img src=\"img\dn.gif\"></td> > </tr> > </table> > > Which is faster? Which is better? Is there another way? > > Christopher J. Crane > Network Operations Manager > > IKON Office Solutions > 860.659.6464 > > >

« previous php.general (#106172) next »