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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php