note 102450 deleted from language.functions by danbrown
| From: | danbrown@php.net | Date: | Tue, 15 Feb 2011 17:51:43 +0000 |
| Subject: | note 102450 deleted from language.functions by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177010@lists.php.net to get a copy of this message | ||
Note Submitter: OJ
----
<html>
<body>
A basic but robust introductory level example of a custom made function that evaluates to an
absolute value, mimicing the abs() predefined function.
Sorry I don't do comments...
<?php
function abs_mimic($eval) {
if ($eval >= 0) {
$var = $eval; }
else {
$var = -$eval; }
echo $var;
}
?>
<?php
$n1 = 1;
$n2 = -1;
echo abs($n1*$n2);
echo abs_mimic($n1*$n2);
?>
</body>
</html>