Re: Str_Replace Command

From: Date: Mon, 02 Feb 2004 16:52:14 +0000
Subject: Re: Str_Replace Command
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-176584@lists.php.net to get a copy of this message
Ok I got around it by the following, but now I have a new problem. I can not get the two dimensional array working. I want to later be able to output a variable like this $TickerData["IKN"] and it will output the associated $Price. $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) { list($Symbol, $Price) = split(",", $Row); $Symbol = str_replace('"', "", $Symbol); $TickerData = array("$Symbol"=>"$Ticker"); } print_r($TickerData); echo $TickerData["IKN"]."<br>\n"; "Jason Wong" <php-general@gremlins.biz> wrote in message news:200402030030.44626.php-general@gremlins.biz... > On Tuesday 03 February 2004 00:14, Christopher J. Crane wrote: > > > $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"; } > > str_replace() RETURNS the replaced string. It does not alter $Row. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > ------------------------------------------ > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > ------------------------------------------ > /* > Spiritual leadership should remain spiritual leadership and the temporal > power should not become too important in any church. > - Eleanor Roosevelt > */

« previous php.general (#176584) next »