faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 1 people (100%) answered Yes
Recently 1 of 1 people (100%) answered Yes

Entry

how do you return a value from a function?

Mar 22nd, 2008 21:29
ha mo, Chad Currie, Himanshu Jain, http://www.blogvoid.com/


You must use the return keyword.
eg.
<?php
function hiworld()
{
$mytext='Hello World';
return $mytext;
}
$res = hiworld();
echo $res;
?>
The sample above would print Hello World
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.templatestemp.com