limits to functions?
Posted: Sat Apr 21, 2007 10:27 pm
Is there a limit to how many variables can be passed to a function?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
function foo() {
$params = func_get_args();
echo count($params), "\n";
}
for($e=1; $e<6; $e+=1) {
$params = range(1, pow(10, $e));
call_user_func_array('foo', $params);
}
?>Call it lack of imagination but I can't think of a well-designed function that takes a hundred thousand parameters.10
100
1000
10000
100000
even weirder there's no such thing in the example.SmokyBarnable wrote:
I didn't know you could call a function from within the same function....weird.
And if you're not careful, can net you some hot water.d11wtq wrote:It's called recursion
recursion can be very useful if used properly and very dangerous if not.feyd wrote:And if you're not careful, can net you some hot water.d11wtq wrote:It's called recursion
Unless you know what you're doing, try to stay away from recursion.