note 24239 added to functions

From: Date: Sat, 10 Aug 2002 11:17:27 +0000
Subject: note 24239 added to functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-34661@lists.php.net to get a copy of this message
Although yasuo_ohgaki@hotmail.com has already pointed the recursion support on PHP, here's another example, wich shows clearly the mechanism of recursive algorithms: function fact($i){ if($i==1){ return 1; }else{ return $i*fact($i-1); } } It returns $i! (supposing $i is a valid positive integer greater than 0). -- http://www.php.net/manual/en/functions.php http://master.php.net/manage/user-notes.php?action=edit+24239 http://master.php.net/manage/user-notes.php?action=delete+24239 http://master.php.net/manage/user-notes.php?action=reject+24239

« previous php.notes (#34661) next »