Reply to Re: [PHP] Function Overloading

Your name:

Reply:


Posted by tg-php on 12/18/05 04:33

If all you want to do is pass an unknown number of arguments to a function, this looks like it demonstrates what you're doing:

<?php
function foo()
{
$numargs = func_num_args();
echo "Number of arguments: $numargs\n";
}

foo(1, 2, 3); // Prints 'Number of arguments: 3'
?>

Found it at:
http://www.php.net/manual/en/function.func-num-args.php


= = = Original message = = =

"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!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация