add more interesting PHP example code
This commit is contained in:
parent
44907e90f4
commit
f99499bac3
1 changed files with 15 additions and 1 deletions
16
editor.html
16
editor.html
|
|
@ -159,7 +159,21 @@ for i in sys.argv[1:]:
|
|||
|
||||
<script type="text/editor" id="phptext"><?php
|
||||
|
||||
phpinfo();
|
||||
function nfact($n) {
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return $n * nfact($n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\nPlease enter a whole number ... ";
|
||||
$num = trim(fgets(STDIN));
|
||||
|
||||
// ===== PROCESS - Determing the factorial of the input number =====
|
||||
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
|
||||
echo $output;
|
||||
|
||||
?></script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue