public static function convert($amount, $from, $to, $cent = true) {
    // Get the conversion rate
    $rate = Connect2PayCurrencyHelper::getRate($from, $to);

    if ($rate != null) {
      $convert = $amount * $rate;

      // If the amount was in cent, truncate the digit after the comma
      // else round the result to 2 digits only
      return ($cent) ? round($convert, 0) : round($convert, 2);
    }

    return null;
  }
public static function convert($amount, $from, $to, $cent = true) {
    // Get the conversion rate
    $rate = Connect2PayCurrencyHelper::getRate($from, $to);

    if ($rate != null) {
      $convert = $amount * $rate;

      // If the amount was in cent, truncate the digit after the comma
      // else round the result to 2 digits only
      return ($cent) ? round($convert, 0) : round($convert, 2);
    }

    return null;
  }
public static function convert ( $ amount , $ from , $ to , $ cent = true ) { // Get the conversion rate $ rate = Connect2PayCurrencyHelper :: getRate ( $ from , $ to ) ; if ( $ rate != null ) { $ convert = $ amount * $ rate ; // If the amount was in cent, truncate the digit after the comma // else round the result to 2 digits only return ( $ cent ) ? round ( $ convert , 0 ) : round ( $ convert , 2 ) ; } return null ; }
Convert an amount from one currency to another

@param int $amount
The amount to convert
@param string $from
The source currency
@param string $to
The destination currency
@param boolean $cent
Specifies if the amount is in cent (default true)
@return integer The converted amount or null in case of error
Convert an amount from one currency to another