Hi all,
I am working with some data in a CVS file. The content following the following format:
AEDBuy=6.4452&AEDSell=5.1002&ANGBuy=3.164&ANGSell=2.298&ARSBuy=6.8626&ARSSell=5.3583
So far I have managed to replave the & sign with a comma to make it a truve CVS but I am now trying to extract the data into an array which I can manipulate and feed it into a SQL tabel. I have also remove the = sign.
$file_handle = fopen("DATA/lgwrates.txt", "rb");
while (!feof($file_handle) ) {
$line_of_text = fgets($file_handle);
if($line_of_text
$line_of_text = str_replace("&", ",", $line_of_text);
$line_of_text = str_replace("=", "", $line_of_text);
$parts = explode(',', $line_of_text);
foreach( $parts as $key=> $value){
$rate = $value;
$country = substr($rate,1,3);
$sellRate = substr($rate,6);
The issue I have is how can I read the data from the file so that I end up with:
AEDBuy6.4452AEDSell=5.1002,ANGBuy3.164ANGSell=2.298,ARSBuy6.8626ARSSell=5.3583 and so on.
I may be going about this completely wrong so if someone could point me in the right direction that would be great.
Many thanks in advance.
Dereck