Re: novice question
| From: | Jason Cox | Date: | Thu, 28 Feb 2002 16:14:36 +0000 |
| Subject: | Re: novice question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-86619@lists.php.net to get a copy of this message | ||
JD,
This is how you would do it:
<?
$ab = add($a,$b);
echo"$ab";
?>
- or you could do it directly like this -
<?
echo add($a,$b);
?>
- or my personal preference -
<?=add($a,$b)?>
===============
<?
function add($a,$b)
{
$ab =$a+$b;
return $ab;
}
?>
A quick read of the section on functions in the online manual would be a
great resource. In fact, I recommend checking the manual before posting to
this list. It's a great tool and contains user comments. Chances are that
if you have a problem, someone else has already run into it and posted the
solution in the manual. Here's a link:
http://www.php.net/manual/en/functions.php
Regards,
Jason Cox
----- Original Message -----
From: "me us" <durameen@hotmail.com>
To: <php-general@lists.php.net>
Sent: Wednesday, February 27, 2002 2:23 PM
Subject: [PHP] novice question
> Hi
> Id reeeeeeaaaaaaaally like to know the syntax for returning results from
a
> called function to the program that called it;)
>
> <?
> program
>
> add($a,$b);
> echo"$ab";
> ?>
>
>
> ===============
> <?
>
> function add($a,$b)
> {
> $ab =$a+$b;
> }
> return??????????????????????????
>
>
> ?>
>
>
> Many many thanks
>
> JD
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger:
> http://messenger.msn.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>