П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 3439 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 5995 раз(а).

Учебник HTML.
Просмотров 3221 раз(а).

Руководство по PHP5.
Просмотров 5442 раз(а).

Хостинг через призму DNS.
Просмотров 4050 раз(а).

Подборка текстов стандартных документов.
Просмотров 55723 раз(а).

Учебник PHP - Самоучитель
Просмотров 3021 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 4821 раз(а).

Внешние атаки...
Просмотров 3759 раз(а).

Учебник PHP.
Просмотров 2782 раз(а).

SSI в примерах.
Просмотров 37396 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь



Установка электропривода сдвижной двери на микроавтобус премьер-бас.рф.


Руководство по PHP
Пред. Глава 46. Zend API: Hacking the Core of PHP След.

Returning Values

Returning values from your functions to PHP was described briefly in an earlier section; this section gives the details. Return values are passed via the return_value variable, which is passed to your functions as argument. The return_value argument consists of a zval container (see the earlier discussion of the call interface) that you can freely modify. The container itself is already allocated, so you don't have to run MAKE_STD_ZVAL on it. Instead, you can access its members directly.

To make returning values from functions easier and to prevent hassles with accessing the internal structures of the zval container, a set of predefined macros is available (as usual). These macros automatically set the correspondent type and value, as described in Табл. 46-14 and Табл. 46-15.

Замечание: The macros in Табл. 46-14 automatically return from your function, those in Табл. 46-15 only set the return value; they don't return from your function.

Таблица 46-14. Predefined Macros for Returning Values from a Function

MacroDescription
RETURN_RESOURCE(resource)Returns a resource.
RETURN_BOOL(bool)Returns a Boolean.
RETURN_NULL()Returns nothing (a NULL value).
RETURN_LONG(long)Returns a long.
RETURN_DOUBLE(double)Returns a double.
RETURN_STRING(string, duplicate) Returns a string. The duplicate flag indicates whether the string should be duplicated using estrdup().
RETURN_STRINGL(string, length, duplicate) Returns a string of the specified length; otherwise, behaves like RETURN_STRING. This macro is faster and binary-safe, however.
RETURN_EMPTY_STRING()Returns an empty string.
RETURN_FALSEReturns Boolean false.
RETURN_TRUEReturns Boolean true.

Таблица 46-15. Predefined Macros for Setting the Return Value of a Function

MacroDescription
RETVAL_RESOURCE(resource)Sets the return value to the specified resource.
RETVAL_BOOL(bool)Sets the return value to the specified Boolean value.
RETVAL_NULLSets the return value to NULL.
RETVAL_LONG(long) Sets the return value to the specified long.
RETVAL_DOUBLE(double) Sets the return value to the specified double.
RETVAL_STRING(string, duplicate) Sets the return value to the specified string and duplicates it to Zend internal memory if desired (see also RETURN_STRING).
RETVAL_STRINGL(string, length, duplicate) Sets the return value to the specified string and forces the length to become length (see also RETVAL_STRING). This macro is faster and binary-safe, and should be used whenever the string length is known.
RETVAL_EMPTY_STRING Sets the return value to an empty string.
RETVAL_FALSE Sets the return value to Boolean false.
RETVAL_TRUE Sets the return value to Boolean true.

Complex types such as arrays and objects can be returned by using array_init() and object_init(), as well as the corresponding hash functions on return_value. Since these types cannot be constructed of trivial information, there are no predefined macros for them.


Пред. Начало След.
Duplicating Variable Contents: The Copy ConstructorУровень выше Printing Information


Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru