Link to home
Start Free TrialLog in
Avatar of nzrubin
nzrubinFlag for New Zealand

asked on

function calling

hello Experts!
interesting question:

why if i call function like that:

echo "<table><tr><td>";
some_function($some_var);
echo "</td></tr></table>";

it output at the sell of the table.

but if i call function like that:

echo "<table><tr><td>".some_function($some_var)."</td></tr></table>";

it displays not in the table but somwhere at the page

?
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of loki23
loki23

in order for the concatenation to work, the function would have to be evaluated BEFORE the string is echoed, therefore, if the function uses it's own echo statement, instead of a return statement it will echo in the function first and then process the first echo statement
Avatar of nzrubin

ASKER

thanks i got it :)