RE: [PHP] VERY basic function question
| From: | YaronKh at clalit dot org dot il | Date: | Thu, 17 Mar 2005 09:01:33 +0000 |
| Subject: | RE: [PHP] VERY basic function question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-210948@lists.php.net to get a copy of this message | ||
And another thing
Let say you called you function count1
Change :
count1($setvar);
to :
$result = count1($setvar);
echo "$result";
-----Original Message-----
From: William Stokes [mailto:kalles@operamail.com]
Sent: Thursday, March 17, 2005 10:25 AM
To: php-general@lists.php.net
Subject: [PHP] VERY basic function question
I'm trying to learn functions (just started). I can't see why this fails:
<?php
function count($var)
{
if ($var == 10){
$result = $var + 10;
return $result;
}
else {
$result = $var + 20;
return $result;
}
}
$setvar = 10;
count($setvar);
echo "$result";
?>
I probably just didn't understand my manual. Any ideas?
Thanks
-Will
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php