diff options
author | Etienne Kneuss <colder@php.net> | 2008-06-06 23:53:43 +0000 |
---|---|---|
committer | Etienne Kneuss <colder@php.net> | 2008-06-06 23:53:43 +0000 |
commit | b5eaa1005a79aa0163bd7f3372f2ae371ddb9684 (patch) | |
tree | 46f0b9836c5939e95fa16dc74f2c01265a6873b6 /ext/spl/spl_engine.c | |
parent | 6b68a9424231c2addd0cae4876518dd94ddc8dc6 (diff) | |
download | php-git-b5eaa1005a79aa0163bd7f3372f2ae371ddb9684.tar.gz |
MFH: Implements C arrays wrapper
Diffstat (limited to 'ext/spl/spl_engine.c')
-rwxr-xr-x | ext/spl/spl_engine.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/spl/spl_engine.c b/ext/spl/spl_engine.c index 72dd6a71bf..4ca8ba646d 100755 --- a/ext/spl/spl_engine.c +++ b/ext/spl/spl_engine.c @@ -43,6 +43,26 @@ PHPAPI void spl_instantiate(zend_class_entry *pce, zval **object, int alloc TSRM } /* }}} */ +PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC) /* {{{ */ +{ + switch(Z_TYPE_P(offset)) { + case IS_STRING: + ZEND_HANDLE_NUMERIC(Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, idx); + break; + case IS_DOUBLE: + case IS_RESOURCE: + case IS_BOOL: + case IS_LONG: + if (Z_TYPE_P(offset) == IS_DOUBLE) { + return (long)Z_DVAL_P(offset); + } else { + return Z_LVAL_P(offset); + } + } + return -1; +} +/* }}} */ + /* * Local variables: * tab-width: 4 |