| Conditions | 2 |
| Paths | 2 |
| Total Lines | 10 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public static function convert($from, $to, $amount, $round) { |
||
| 26 | |||
| 27 | $params = "a=".urlencode($amount)."&from=".urlencode($from)."&to=".urlencode($to); |
||
| 28 | $get = file_get_contents("https://www.google.com/finance/converter?".$params); |
||
| 29 | $get = explode("<span class=bld>",$get); |
||
| 30 | $get = explode("</span>",$get[1]); |
||
| 31 | $converted_amount = preg_replace("/[^0-9\.]/", null, $get[0]); |
||
| 32 | |||
| 33 | return ($round ? number_format($converted_amount, 2) : $converted_amount); |
||
| 34 | } |
||
| 35 | |||
| 36 | } |