Re: GMP object and is_scalar()

From: Date: Sun, 29 Dec 2013 08:16:20 +0000
Subject: Re: GMP object and is_scalar()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-70905@lists.php.net to get a copy of this message
On Sun, Dec 29, 2013 at 5:09 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:

> GMP object is object. Therefore, is_scalar() returns false for GMP
> objects.
>
> [yohgaki@dev php-src]$ ./php-bin -r '$v = gmp_init("0");
> var_dump(gettype($v));'
> string(6) "object"
> [yohgaki@dev php-src]$ ./php-bin -r '$v = gmp_init("0");
> var_dump(is_scalar($v));'
> bool(false)
>
> This is correct behavior, but this behavior is debatable, IMO.
>
> Any comments?
>

is_numeric() can be problematic also.

[yohgaki@dev php-src]$ ./php-bin -r '$v = gmp_init("0");
var_dump(is_numeric($v));'
bool(false)

--
Yasuo Ohgaki
yohgaki@ohgaki.net


Thread (17 messages)

« previous php.internals (#70905) next »