At 14:35 3-7-2003, you wrote:
> -----Original Message-----
> From: Jeff Moser [mailto:[EMAIL PROTECTED]
> Sent: 03 July 2003 13:07
>
> So...why not write the entire included file as a function and
> then call that
> function instead of using include? I'd be interested, though,
> to hear if the
> return broke out of the include.
Mike Ford:
Well, it damn well better, as the manual page at http://www.php.net/include says it does! (You can return a value, as well, if you really must.)

ah that's interesting.


another option using multiple returns in one function:

function testvars($var1,$var2)
{ if ($var1<1)                   return 'var1 must be a positive integer';
  if ($var2=='bad')             return 'var2 is bad!';

  //this line is only reached when all vars are tested ok:
  return true;
}


$result=testvars($var1,$var2);


if ($result!=true) {
echo $result.'<br>Please warp to your previous location';
exit();
}





-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to