Re: Object arithmetic

From: Date: Thu, 18 Oct 2007 05:13:51 +0000
Subject: Re: Object arithmetic
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-32842@lists.php.net to get a copy of this message
On 10/18/07, Stanislav Malyshev <stas@zend.com> wrote: > > While looking at bug 42780: > > http://bugs.php.net/bug.php?id=42780 > > The only way not to lose precision is to explicitly cast the object to > > float or string, which just doesn't seem right to me. > > I'm not sure how this can be fixed - there should be some type used and > many objects won't provide convertor to float... Anyway, it's probably > not the best idea to rely on default conversion in this context - better > to specify it. In this case, the proper solution is to force SimpleXML to cast values to strings, because, after all, XML has nothing but strings. Then engine would be able to cast the value further to float (as the last example in bug shows) -- Alexey Zakhlestin http://blog.milkfarmsoft.com/

« previous php.internals (#32842) next »