On Sun, 2004-05-16 at 17:57, Timm Friebe wrote: > On Sun, 2004-05-16 at 17:17, Ard Biesheuvel wrote: [...] > -- snip -- > Z_STRLEN(result->data[i][j]) = result->lengths[j]-1; > Z_STRVAL(result->data[i][j]) = estrndup(result->tmp_buffer[j], > result->lengths[j]); > Z_TYPE(result->data[i][j]) = IS_STRING; > > /* Now I want to figure out whether this fits into a long, > * and if it does, make it one, a double otherwise > */ > > -- snip -- > > Possible ideas would be to use strtol and check for ERANGE (sample > attached).
Or, replying to myself, simply use convert_scalar_to_number() from Zend/zend_operators.c which (AFAIS) does pretty much the same. The testcase I wrote for this (attached) is passed here. Ard, do you use sybase_ct? If so, could you verify it works for you, too? - Timm
test_long.phpt
Description: application/php
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php