Re: Source type.c says settype($var, "double") is deprecated

From: Date: Sun, 06 Jan 2008 22:30:48 +0000
Subject: Re: Source type.c says settype($var, "double") is deprecated
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-34562@lists.php.net to get a copy of this message
On Jan 6, 2008 9:23 PM, Markus Fischer <markus@fischer.name> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > Hannes Magnusson wrote: > | No, the comment is correct. > | > | "for historical [read: BC] reasons "double" is returned in case of a > | float, and not simply "float"" > | > | See http://docs.php.net/settype && > http://docs.php.net/gettype > > Thanks for the pointers, but I don't quite understand what "deprecate" > now means. It means that maybe someday it will be removed. Unlikely? Sure, but the preferred name is 'float' so why not use it? > Doing gettype(1.5) returns "double". There's not way that gettype() > returns "float". Right. Due to historical reasons this functions returns 'double'. Just like for historical reasons implode() can take its argument in either order. > I don't see the implications of this "deprecation" here. What does it > say? The comment in the sourceis there since around 2002 or so. But > there aren't plans to change the behavior or gettype(), are there? It means that in PHP the type name is 'float' and referred to as 'float' throughout the manual For convenience you can use "double" (is_double($f), (double)$f, settype($f, "double")..), just like you can use is_integer() instead of is_int()... :) -Hannes

« previous php.internals (#34562) next »