PayPal\Converter\FormatConverter::formatToNumber PHP Méthode

formatToNumber() public static méthode

Defaults to 2 decimal places
public static formatToNumber ( $value, integer $decimals = 2 ) : null | string
$value
$decimals integer
Résultat null | string
    public static function formatToNumber($value, $decimals = 2)
    {
        if (trim($value) != null) {
            return number_format($value, $decimals, '.', '');
        }
        return null;
    }

Usage Example

Exemple #1
0
 /**
  * Cost in percent. Range of 0 to 100.
  *
  * @param string $percent
  * 
  * @return $this
  */
 public function setPercent($percent)
 {
     NumericValidator::validate($percent, "Percent");
     $percent = FormatConverter::formatToNumber($percent);
     $this->percent = $percent;
     return $this;
 }
All Usage Examples Of PayPal\Converter\FormatConverter::formatToNumber