Re: Function Overloading

From: Date: Sun, 18 Dec 2005 21:25:51 +0000
Subject: Re: Function Overloading
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-227628@lists.php.net to get a copy of this message
Labunski wrote:
"PHP does not support function overloading." So, is there any other way of getting a number of parameters(variables) passed to a function? aka. function fruits($apple, $banana, $kiwi, $grape){ #should (somehow) output 4 } OK. if it was an array, than I could use count($array), but now I'm stuck! Thanks in advance!
func_num_args() will do the trick. and then you use func_get_arg() or func_get_args() to use them. http://au2.php.net/func_num_args --josh

« previous php.general (#227628) next »