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;
<td>S & P</td>
<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>
Which is faster? Which is better? Is there another way?

Christopher J. Crane
Network Operations Manager

IKON Office Solutions


Reply via email to