here are i am providing some examples of echo
Example 1
echo 'The sum is ', 1 + 2; //works fine
Example 2
$x=true;
echo '$x is undefined value ' , ($x===true) ? 'NO' : 'Yes'; //Works fine
Example 3
function f($arg){
return $arg;
}
echo 'hello ' , f('buddy'); //Works fine
Example 4 -
echo 'hello ' , if($a) { return "wowo"; } else { return "fine"; }; // generate parse error
Here is the point that all example working fine but example 4 its generating parse error.
my questions is that -
1. language constructs
can be used for echo
arguments ?
2. If yes language constructs
can be used, how can we use language constructs
for echo
arguments ?
3. Only functions
that return strings can be passed to echo
arguments ?