7.33 Fonctions
7 Index des fonctions
Manuel PHP
. Introduction . Pré-requis . Installation . Configuration à l'exécution . Constantes prédefinies . call_user_func_array . call_user_func . create_function . func_get_arg . func_get_args ->func_num_args . function_exists . get_defined_functions . register_shutdown_function . register_tick_function . unregister_tick_function
|
7.33.11 func_num_args()
Retourne le nombre d'arguments passé à la fonction
[ Exemples avec func_num_args ] PHP 4
int
func_num_args (
void
)
func_num_args
retourne le nombre d'arguments
passé à la fonction utilisateur courante.
func_num_args
générera une alerte si elle est appelée
hors d'une fonction.
Exemple avec func_num_args |
<?php function foo() { $numargs = func_num_args(); echo "Nombre d'arguments: $numargs\n"; } foo (1, 2, 3); // affiche 'Nombre d'arguments: 3' ?>
|
func_get_arg
peut être utilisé
conjointement à
func_num_args
et
func_get_args
pour permettre aux fonctions
utilisateurs d'accepter un nombre variable d'arguments.
|