rendered paste body/* {{{ proto mixed end(array array_arg)
Advances array argument's internal pointer to the last element and return it */
PHP_FUNCTION(end)
{
zval **array, **entry;
HashTable *target_hash;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
target_hash = HASH_OF(*array);
if (!target_hash) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed variable is not an array or object");
RETURN_FALSE;
}
zend_hash_internal_pointer_end(target_hash);
if (return_value_used) {
if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
RETURN_FALSE;
}
RETURN_ZVAL(*entry, 1, 0);
}
}
/* }}} */
/* {{{ proto mixed current(array array_arg)
Return the element currently pointed to by the internal array pointer */
PHP_FUNCTION(current)
{
zval **array, **entry;
HashTable *target_hash;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &array) == FAILURE) {
WRONG_PARAM_COUNT;
}
target_hash = HASH_OF(*array);
if (!target_hash) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed variable is not an array or object");
RETURN_FALSE;
}
if (zend_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
RETURN_FALSE;
}
RETURN_ZVAL(*entry, 1, 0);
}
/* }}} */