PHP: How can I eliminate quotes around output from CSV file?

Posted by brian johnson on Stack Overflow See other posts from Stack Overflow or by brian johnson
Published on 2012-06-24T00:00:49Z Indexed on 2012/06/24 9:16 UTC
Read the original article Hit count: 229

Filed under:
|

This code:

<?php $curl=curl_init();
curl_setopt ($curl,CURLOPT_URL,"http://download.finance.yahoo.com/d/quotes.csv?s=XIN&f=l1c1p2rj1y&e=.csv");
curl_setopt ($curl,CURLOPT_HEADER,0);
ob_start();
curl_exec ($curl);
curl_close ($curl);
$data=ob_get_clean();
$data = explode(",",$data);
foreach ($data as $results)
echo "<td>$results</td>";
?>

yields these results in my browser: 2.80 +0.02 "+0.72%" 1.85 204.2M 1.44

How can I have this PHP code above eliminate the quotations around the "+0.72%" so the end result is just: 0.72% ?

© Stack Overflow or respective owner

Related posts about php

Related posts about csv