Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
bool Index::test_global_var()
{
int i = 0;
HashTable *ht = &EG(symbol_table);
ZEND_HASH_FOREACH(ht, 0)
if (_p->key != NULL) {
php_printf("Global Variable [%d]: \"%s\" ", i, _p->key->val);
i++;
}
if (_z) {
switch (Z_TYPE_P(_z)) {
case IS_NULL:
php_printf("NULL: null\n");
break;
case IS_TRUE:
php_printf("BOOL: true\n");
break;
case IS_FALSE:
php_printf("BOOL: false\n");
break;
case IS_LONG:
php_printf("LONG: %ld\n", Z_LVAL_P(_z));
break;
case IS_DOUBLE:
php_printf("DOUBLE: %g\n", Z_DVAL_P(_z));
break;
case IS_STRING:
php_printf("STRING: value=\"");
PHPWRITE(Z_STRVAL_P(_z), Z_STRLEN_P(_z));
php_printf("\", length=%zd\n", Z_STRLEN_P(_z));
break;
case IS_RESOURCE:
php_printf("RESOURCE: id=%d\n", Z_RES_HANDLE_P(_z));
break;
case IS_ARRAY:
php_printf("ARRAY: hashtable=%p\n", Z_ARRVAL_P(_z));
break;
case IS_OBJECT:
php_printf("OBJECT: object=%p\n", Z_OBJ_P(_z));
break;
default:
php_printf("Unknown Type\n");
break;
}
} else {
php_printf("_z is NULL\n");
}
php_printf("<br/>");
ZEND_HASH_FOREACH_END();
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.