You should return a string when using your function with echo
So do something like this
//this is inside frank $ret = $greeting.$name.$2nd; return $ret;
Secondly, $greeting is a variable declared outside the function definition. Therefore, you should not use it inside a function definition.
Now you will look like this:
function frank () { $greeting = 'hello'; $name = 'frank'; $2nd = 'robson'; $ret = $greeting.$name.$2nd; return $ret; }
In addition, there is an error in the first line. $greeting 'Hello' is incorrect. It should be $greeting = 'Hello' (you don't have the = sign).
Ankit Jan 09 '12 at 9:50 2012-01-09 09:50
source share