On Sat, Nov 17, 2012 at 8:15 AM, Nikita Popov <nikita....@gmail.com> wrote: > Hi internals! > > It happens quite often that you need to extract an integer from a zval and > you also want it to work for integers in strings, etc. In order to do so > you currently have to cast the zval to integer. This is always rather > complicated because you often don't want to actually change the passed > zval. So you end up allocating / separating zvals and stuff like that. And > I'm always confused just which exactly of the 50 different ways to cast a > zval one should use in a particular situation. > > What I'd like to propose is a set of two new functions, which castingly get > an integer or a float from a zval. The functions could look like this: > > long zval_get_long_with_cast(zval *value) > double zval_get_double_with_cast(zval *value) > > What do you think? > > Nikita
I'm new to internals but this is one thing I've dealt with. I would certain vote for it. Question: how does this handle objects, arrays and resources? For a particular use-case I need something that works on integers and integers in strings only. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php