substr not working in array
<p>Array ( [0] => Array ( [0] => 21.2694 USD  ) [1] => Array ( [0] => 21.2694 USD ) ) </p>

<p>(this is basicall google currency converter)</p>

<p>echo $arr[0][0]; //output is 21.2694 usd</p>

<p>But i want Output like 21.26 USD</p>

<p>What is tried is ,
echo substr($arr[0][0],0,5);//For this substr line i expected output is 21.26</p>

<p>But am getting just blank page, </p>

<p>Where i made mistake</p>

<p>i want 21.26USD as the output if i give the input as 21.2694 USD</p>

<p>Basically am doing the currency converter (google api)</p>

<p>But api producing result as 29.5645 USD from in this , i want to make out put as 29.56 USD ,</p>

<p>This is my snippet ,</p>

<pre>   
    $from_currency = "GBP";
    $selected_currency = 'USD';
    $txt_cash_price = '10';
    $txt_card_price = '14';

    $get_currency = file_get_contents("http://www.google.com/finance/converter?a=$txt_cash_price&from=$from_currency&to=$selected_currency");
    preg_match_all("/(.*)/", $get_currency, $matches,PREG_PATTERN_ORDER);
    $caprice = $matches[0][0];

       OUPUT SOMTHING LIKE THIS 15.2070 USD
</pre>

<p>But i want output as 15.20 USD</p>
