October 24, 2024
Chicago 12, Melborne City, USA
PHP

How do you know you have an ArrayIterator in a PHP extension


In SaxonC PHP extension (written in C++) I am writing utility to allow users to write custom functions in their PHP script which will get called in XSLT, XPath or XQuery. Therefore we have to handle a number of PHP native return types from the user function. This I can do without problem, except for ArrayIterators. We get back a zval which can be an ArrayIterator. But how can I check if it is actually an ArrayIterator type in the PHP internals using the Zend framework written in C++ code?
See the coe snippet below:

zval retval;
int value = (int)Z_TYPE_P(&retval)

The value gives zero (i.e. IS_UNDEF) when I know its should be an ArrayIterator and not IS_OBJECT. How can I check for ArrayIterator?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video