Re: Adding "numeric" type hint

From: Date: Thu, 30 Apr 2015 17:10:49 +0000
Subject: Re: Adding "numeric" type hint
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-86099@lists.php.net to get a copy of this message
On Thu, Apr 30, 2015 at 7:35 AM, Levi Morrison <levim@php.net> wrote: > This numeric type is a type of int or float. There is a formal name > for such types: union types. Some languages have syntax for union > types that would look like this: int | float. I have a draft RFC for > this subject: https://wiki.php.net/rfc/union_types. Union types > would > be useful for other common cases as well, such as Foo | null or > array | Traversable. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Yes, this a union type. As I understand the request, the union type definition would look like int|float| string where is_numeric(string) is true. According to the definition of is_numeric, it does not check to see if the string can be cast into an int or float, only that it could parsed an stuffed into a bignum or GMP object. Walter -- The greatest dangers to liberty lurk in insidious encroachment by men of zeal, well-meaning but without understanding. -- Justice Louis D. Brandeis

« previous php.internals (#86099) next »