I have a question about my functions. Let me explain, I have two functions:
/* This function works properly
; example : echo first('Hello world', 'return');
*/
function first($string, $return = 'echo')
{
if($return == 'echo')
{
echo $string;
}
else
{
return $string;
}
}
And this is second, function, is calling first function.
/* This function doesn't works
; example : echo second('my string', 'return');
*/
function second($string, $return = 'echo')
{
first($string, $return);
}
The problem is I want the second function like that, as simple as above.
You need to
returnfromsecond(). Otherwise,first(), called inside it, willechooutput, but the value it returns to its caller (second()) goes nowhere and is lost. Return the value of the call tofirst()fromsecond().