Pchp.Library.Variables.is_numeric C# (CSharp) Method

is_numeric() public static method

Checks whether a dereferenced variable is numeric.
public static is_numeric ( PhpValue variable ) : bool
variable Pchp.Core.PhpValue The variable.
return bool
        public static bool is_numeric(PhpValue variable)
        {
            switch (variable.TypeCode)
            {
                case PhpTypeCode.Int32:
                case PhpTypeCode.Long:
                case PhpTypeCode.Double:
                    return true;

                case PhpTypeCode.String:
                case PhpTypeCode.WritableString:
                    PhpNumber tmp;
                    return (variable.ToNumber(out tmp) & Core.Convert.NumberInfo.IsNumber) != 0;

                default:
                    return false;
            }
        }