Parameter Retrieval

int zend_get_parameters(int ht, int param_count, ...);
int zend_get_parameters_ex(int param_count, ...);
int zend_get_parameters_array(int ht, int param_count, zval **argument_array);
int zend_get_parameters_array_ex(int param_count, zval ***argument_array);

Maps the current function call's argument stack into zval* values_ex variants map to an additional level of indirection: zval**. See also: Chapter 7, "Accepting Parameters."

Argument

Purpose

ht

Deprecated. This parameter is always ignored by these methods.

param_count

The number of zval* or zval** containers passed as either individual parameters or vector units.

...

Variable argument list expecting param_count instances of references to the desired data type; that is, zval**, or zval*** for the _ex version.

argument_array

Vector containing sufficient space to store param_count zval* or zval** elements.

int zend_copy_parameters_array(int param_count, zval *argument_array
TSRMLS_DC);

Maps the current function call's argument stack into a pre-initialized Array variable suitable for exporting to userspace. Each value's refcount is implicitly increased as a result of being placed in argument_array.

Argument

Purpose

param_count

Number of parameters to copy from the stack to the target array. This value must be equal to or less than the actual number of parameters available.

argument_array

Target zval* to copy parameters into. argument_array must be allocated and initialized as an array (for example, using array_init()) prior to being used in this function).

int ZEND_NUM_ARGS(void);

Returns the number of arguments waiting on the current function call's parameter stack.

int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC,
 char *type_spec, ...);
int zend_parse_method_parameters(int num_args TSRMLS_DC,
 zval *this_ptr, char *type_spec, ...);
int zend_parse_method_parameters_ex(int flags, int num_args TSRMLS_DC,
 zval *this_ptr, char *type_spec, ...);

Maps the current function call's argument stack into native C data types converting where possible. Provides automatic userspace error reporting on failure.

Arguments

Purpose

num_args

The number of arguments actually waiting on the stack. This should always be populated using the ZEND_NUM_ARGS() macro.

type_spec

Argument type specifier. Arguments processed will be validated against these types and converted if necessary. Refer to Chapter 7 for details on this field.

...

Dereferenced native C data types to be populated with values parsed from the argument stack. See Chapter 7.

flags

A bitmask field currently allowing only one possible valueZEND_PARSE_PARAMS_QUIETwhich suppresses warning and failure messages.

this_ptr

A zval* containing the current object instance such as returned by getThis().



The PHP Life Cycle

Variables from the Inside Out

Memory Management

Setting Up a Build Environment

Your First Extension

Returning Values

Accepting Parameters

Working with Arrays and HashTables

The Resource Data Type

PHP4 Objects

PHP5 Objects

Startup, Shutdown, and a Few Points in Between

INI Settings

Accessing Streams

Implementing Streams

Diverting the Stream

Configuration and Linking

Extension Generators

Setting Up a Host Environment

Advanced Embedding

Appendix A. A Zend API Reference

Appendix B. PHPAPI

Appendix C. Extending and Embedding Cookbook

Appendix D. Additional Resources



Extending and Embedding PHP
Extending and Embedding PHP
ISBN: 067232704X
EAN: 2147483647
Year: 2007
Pages: 175
Authors: Sara Golemon

Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net