Multiple ticker symbols
We had a query from a user who used our stock ticker script and liked it , there query was how about supporting multiple stock tickers . So we set about creating this updated version of our script .
In this example the user must enter the ticker symbols seperated by a comma like this MSFT , SUN , CNET with no spaces between the symbols.
In the script we now seperate this using the explode function which splits the string into an array using a delimiter , in this case commas . This line looks like this
$symbol = explode("," , $symbol);
We then loop through all of the symbols using a for next loop , here is the for statement in our new example .
for ($i=0 ; $i < sizeof($symbol) ; $i++)
{
print "<br>";
?>
<img border="0" src="http://ichart.yahoo.com/t?s=<?php print $symbol[$i]; ?>">
<br>
<?php
next;
}
?>
You can get the whole script by viewing the following file and cutting and pasting it .multistock.txt
|