assigning a variable to a function that returns value
Posted: Fri May 16, 2008 1:12 am
I'm wondering if php functions have return types like asp.net functions. I'm trying to get a php function to return a value by assigning it to a variable like in the following example:
$the_id = get_id();
function get_id()
{
echo 5;
}
echo $the_id;
The problem is the function will not assign a return value to $the_id, it will show a blank where the 5 should be.
get_id() will show the number 5.
Is there a way to get the function get_id() to assign the value of 5 to $the_id variable? Thanks, cm
$the_id = get_id();
function get_id()
{
echo 5;
}
echo $the_id;
The problem is the function will not assign a return value to $the_id, it will show a blank where the 5 should be.
get_id() will show the number 5.
Is there a way to get the function get_id() to assign the value of 5 to $the_id variable? Thanks, cm