Str_Replace Command
| From: | Christopher J. Crane | Date: | Mon, 02 Feb 2004 16:14:02 +0000 |
| Subject: | Str_Replace Command | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176581@lists.php.net to get a copy of this message | ||
I have never had this problem before and it is probably something simple...
Please take a look at the two foreach statements. I am at a loss as to why
the second line does not actually remove the quotes. The first foreach
statement does so how are they different.
$StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";
$StockResults = implode('', file("$StockURL"));
$Rows = split("\n", $StockResults);
foreach($Rows as $Row) { echo
str_replace('"',"",$Row)."<br>\n"; }
foreach($Rows as $Row) { str_replace('"',"",$Row); echo
$Row."<br>\n"; }
Eventually, I need to break apart the $Row into two elements $Symbol and
$Price and then into a two dimensional array. I have done this with the code
below, but so far, I can not get rid of the quotes.
foreach($Rows as $Row){
list($Symbol, $Price) = split("\n", $Row);
$TickerData=array("$Symbol"=>"$Price");
}