You are here: RE: [PHP] passing return value from fucntion « PHP « IT news, forums, messages
RE: [PHP] passing return value from fucntion

Posted by Mike Ford on 03/18/05 11:19

> -----Original Message-----
> From: William Stokes
> Sent: 18/03/05 07:33
>
> Hello,
> Just simple question (I think?)
>
> How to pass return value from function to the main program?
>
> Here's example:
> do some code in funtion to set the $res value:
>
> } elseif ($rightsid == $oik6) {
> $res = ok;
> return $res;
> } elseif ($rightsid == $oik7) {
> $res = notok;
> return $res;
> }
>
> How can I get to use the $res in the main program. The return $res;
> doesn't
> pass the variable to the main program right?

The return statement sets the value of the function call in the main
program, so you need to do something with the value of the function call to
use the return value. For example:

$is_ok = your_function($argument);

or

echo your_function($argument);

Cheers!

Mike


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация