I am learning PHP and still, I'm at a basic level.I got a code,
echo "2>5-",2>5, "
";
I can't understand what happens here.
If anyone can help me.Thanks.
I am learning PHP and still, I'm at a basic level.I got a code,
echo "2>5-",2>5, "
";
I can't understand what happens here.
If anyone can help me.Thanks.
echo prints stuff into the page. “2>5-“ is a string. So, echo prints “2>5-“ to the page. With echo, you can concatenate using the comma (,) symbol. Although, it is more common to concatenate (that is, join two strings together) using the dot (.) symbol.
The second 2>5 is not enclosed in quotes. This indicates it is a boolean expression. In PHP, the boolean value false is casted to an empty string ( “”). So, the result of 2>5 is false, which is converted to an empty string.
Lastly, the “ ” string indicates an escape character designating the start of a new line.
So, in summary, the expression echo "2>5-",2>5, "
";
will output “2>5-” followed by a newline character which has no visual representation. So, you will only see “2>5-” when you run that program.
Hope this helps.