noidtluom Posted November 9, 2007 Share Posted November 9, 2007 Well, first off, look at the code below. It's very easy to understand: <?php class bar { public function anothertest($foo, $bar, $baz) { echo $this->asdf; $num = func_num_args(); echo $num; } } $self = array('a', 'b', 'c', 'd'); print_r($self); $bar = new bar(); $bar->anothertest(); ?> Now, I want to find out how many arguments "anothertest" has before calling it. So if it has three arguments, I will do $bar->anothertest($self['0'], $self['1'], $self['2']); func_num_args can only be called inside the function, so I don't think that will work. How can it be done? Link to comment https://forums.phpfreaks.com/topic/76619-finding-number-of-arguments-in-a-function/ Share on other sites More sharing options...
cooldude832 Posted November 9, 2007 Share Posted November 9, 2007 why would u need to know that? Link to comment https://forums.phpfreaks.com/topic/76619-finding-number-of-arguments-in-a-function/#findComment-387964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.