Join Up!
96817 members and counting!

 
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previousParámetros de las funcionesold_functionnext
Last updated: Tue, 29 Oct 2002
view the printer friendly version or the printer friendly version with notes or change language to Czech | German

Devolver valores

Los valores se retornan usando la instrucción opcional return. Puede devolverse cualquier tipo de valor, incluyendo listas y objetos.

function square ($num) {
    return $num * $num;
}
echo square (4);   // saca '16'.

No puedes devolver múltiples valores desde una función, pero un efecto similar se puede conseguir devolviendo una lista.

function small_numbers() {
    return array (0, 1, 2);
}
list ($zero, $one, $two) = small_numbers();

User Contributed Notes
Devolver valores
add a note about notes
There are no user contributed notes for this page.
previousParámetros de las funcionesold_functionnext
Last updated: Tue, 29 Oct 2002
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: http://phpbuilder.com/
Last updated: Thu Oct 31 18:34:28 2002 EST