function ctools_math_expr_number

Remove any non-digits so that numbers like $4,511.23 still work.

It might be good for those using the 12,345.67 format, but is awful for those using other conventions. Use of the php 'intl' module might work here, if the correct locale can be derived, but that seems unlikely to be true in all cases.

@todo: locale could break this since in some locales that's $4.512,33 so there needs to be a way to detect that and make it work properly.

Parameters

mixed $arg: A number string with possible leading chars.

Return value

mixed Returns a number string.

1 string reference to 'ctools_math_expr_number'
ctools_math_expr::__construct in includes/math-expr.inc
Public constructor.

File

includes/math-expr.inc, line 928

Code

function ctools_math_expr_number($arg) {
    // @todo: A really bad idea: It might be good for those using the 12,345.67
    // format, but is awful for those using other conventions.
    // $arg = preg_replace("/[^0-9\.]/", '', $arg);.
    return $arg;
}