01-11-2008, 09:38 AM
|
#10 (permalink)
|
|
The Wanderer
Join Date: Jan 2008
Posts: 7
Thanks: 0
|
wasn't meant as a rant
And i just needed a converter now so this was perfect and many thanks
just i tried to convert euro to canadian and promptly got a Division by Zero error thats all.
I have just changed getRates to this
php Code:
private function getRates () { if(! file_exists(self:: OPT_FILE)) { $this-> updateRates(); } $szContent = file_get_contents(self:: OPT_FILE); $aContent = json_decode ($szContent); if(! isset($aContent-> {$this-> m_fSourceIntlSymbol})) { if($this-> m_fSourceIntlSymbol == 'EUR') { $source = 1; } else { throw new Exception ('Invalid source currency supplied.'); } } else { $source = $aContent-> {$this-> m_fSourceIntlSymbol}; } if(! isset($aContent-> {$this-> m_fTargetIntlSymbol})) { if($this-> m_fTargetIntlSymbol == 'EUR') { $target = 1; } else { throw new Exception ('Invalid target currency supplied.'); } } else { $target = $aContent-> {$this-> m_fTargetIntlSymbol}; } return array($source, $target); }
Last edited by Wildhoney : 01-11-2008 at 01:13 PM.
|
|
|
|