Example #1
0
        public PhpNumber ToNumber()
        {
            double d;
            long   l;
            var    info = Convert.StringToNumber(ToString(), out l, out d);

            return((info & Convert.NumberInfo.Double) != 0 ? PhpNumber.Create(d) : PhpNumber.Create(l));
        }
Example #2
0
        /// <summary>
        /// Converts given string to a number.
        /// </summary>
        public static PhpNumber ToNumber(string str)
        {
            long   l;
            double d;
            var    info = StringToNumber(str, out l, out d);

            return(((info & NumberInfo.Double) != 0) ? PhpNumber.Create(d) : PhpNumber.Create(l));
        }
Example #3
0
        public static NumberInfo ToNumber(string str, out PhpNumber number)
        {
            long   l;
            double d;
            var    info = StringToNumber(str, out l, out d);

            number = ((info & NumberInfo.Double) != 0) ? PhpNumber.Create(d) : PhpNumber.Create(l);
            return(info);
        }
Example #4
0
        public Convert.NumberInfo ToNumber(out PhpNumber number)
        {
            double d;
            long   l;
            var    info = Convert.StringToNumber(ToString(), out l, out d);

            number = (info & Convert.NumberInfo.Double) != 0
                ? PhpNumber.Create(d)
                : PhpNumber.Create(l);

            return(info);
        }
 public override Convert.NumberInfo ToNumber(ref PhpValue me, out PhpNumber number)
 {
     if (me.Object is IPhpConvertible)
     {
         return(((IPhpConvertible)me.Object).ToNumber(out number));
     }
     else
     {
         PhpException.Throw(PhpError.Notice, string.Format(Resources.ErrResources.object_could_not_be_converted, me.Object.GetType().Name, PhpVariable.TypeNameInt));
         number = PhpNumber.Create(1L);
         return(Convert.NumberInfo.LongInteger);
     }
 }
Example #6
0
 public Convert.NumberInfo ToNumber(out PhpNumber number)
 {
     number = PhpNumber.Create(Count);
     return(Convert.NumberInfo.IsPhpArray | Convert.NumberInfo.LongInteger);
 }
Example #7
0
 public override Convert.NumberInfo ToNumber(ref PhpValue me, out PhpNumber number)
 {
     number = PhpNumber.Create(me.Boolean ? 1L : 0L);
     return(Convert.NumberInfo.IsNumber | Convert.NumberInfo.LongInteger);
 }
Example #8
0
 public override Convert.NumberInfo ToNumber(ref PhpValue me, out PhpNumber number)
 {
     number = PhpNumber.Create(me.Double);
     return(Convert.NumberInfo.IsNumber | Convert.NumberInfo.Double);
 }
Example #9
0
 public override Convert.NumberInfo ToNumber(ref PhpValue me, out PhpNumber number)
 {
     number = PhpNumber.Create(0L);
     return(Convert.NumberInfo.LongInteger);
 }
        //PhpBytes IPhpConvertible.ToBinaryString();

        Convert.NumberInfo IPhpConvertible.ToNumber(out PhpNumber number)
        {
            number = PhpNumber.Create(Id);
            return(Convert.NumberInfo.LongInteger);
        }