note 128812 added to functions.user-defined
| From: | brightboateng003 at gmail dot com | Date: | Sat, 19 Aug 2023 13:58:11 +0000 |
| Subject: | note 128812 added to functions.user-defined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220773@lists.php.net to get a copy of this message | ||
Recursive function can be applied in situation such as calculating the factorial of a number (n!).
An example is shown below:
<?php
function findFactorial($n){
if($n <= 0){
return 1;
};
return $n * findFactorial($n - 1);
}
echo "The factorial of 10 is " . findFactorial(10);
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 51.195.191.7)
----
Manual Page -- https://php.net/manual/en/functions.user-defined.php
Edit -- https://main.php.net/note/edit/128812
Del: integrated -- https://main.php.net/note/delete/128812/integrated
Del: useless -- https://main.php.net/note/delete/128812/useless
Del: bad code -- https://main.php.net/note/delete/128812/bad+code
Del: spam -- https://main.php.net/note/delete/128812/spam
Del: non-english -- https://main.php.net/note/delete/128812/non-english
Del: in docs -- https://main.php.net/note/delete/128812/in+docs
Del: other reasons-- https://main.php.net/note/delete/128812
Reject -- https://main.php.net/note/reject/128812
Search -- https://main.php.net/manage/user-notes.php