I am trying to determine if a key exists in a hash that has been passed
to my function. I couldn't find much information on finding how to do
it, but from greping the source I managed to come up with the following.
Problem is it doesn't work *heh*. All I want to do is check whether the
key exists or not and act appropriately. My code compiles fine, but the
zend_hash_exists() test always returns false. The A facsimile of my code
follows:
-----------------------------------------------------------------------
ZEND_FUNCTION( foofunction ){
zval **paramHash = NULL;
zval *aHash = NULL;
if( ZEND_NUM_ARGS() != 1 ||zend_get_parameters_ex( ZEND_NUM_ARGS(), ¶mHash )
== FAILURE ){
WRONG_PARAM_COUNT;
}
aHash = *paramHash;
if( zend_hash_exists( aHash->value.ht, "foo", sizeof( "foo" ) ) ){
//
// Do something here.
//
}
else{
//
// Do something else here.
//
}
}
-----------------------------------------------------------------------
In my PHP code I have the following:
-----------------------------------------------------------------------
$aHash = array();
$aHash['foo'] = 'fee';
foofunction( $aHash );
-----------------------------------------------------------------------
Cheers,
Rob.
--
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer |
:----------------------------------------------:
| Mail : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:----------------------------------------------:
| Website : http://www.webmotion.com |
| Fax : (613) 260-9545 |
`----------------------------------------------'
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php