Re: Are PHP user-defined functions recursive?

From: Date: Wed, 11 Jul 2001 19:52:35 +0000
Subject: Re: Are PHP user-defined functions recursive?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10303@lists.php.net to get a copy of this message
"Ken Sommers" <mrsql.php@worldnet.att.net> wrote in message news:000a01c10a32$a8ec8540$7344500c@zeospantera... > What is function overloading? Overloading is the ability to define several functions by the same name but with different parameter lists and let the compiler figure out which one you meant by the parameters you pass to it. For instance, in C++ you could define a class Square, and then define a number of different constructors: Square(void), Square(Square orig), Square(Point topleft, Point bottomright), Square(int left, int top, int width), and so on. Since PHP is untyped, this would in any case reduce to a variable number of parameters, which is far less useful. > Can a php user-defined function call itself from within itself? Sure: <?php function recurse($n) { echo " $n"; if ($n > 1) recurse($n-1); } recurse(10); ?>

« previous php.db (#10303) next »