+ 1
1. How echo "end of line" ('\n') ? 2. Why echo $var+$car is 0 ?
4 Answers
+ 3
1.
You can add \n in a double quoted string. Then it will be interpreted as newline character.
Or you can concatenate the the constant PHP_EOL to your string.
echo 'some text' . PHP_EOL;
On both ways you have to put it inside <pre></pre> tags or something similar.
Or add a <br> tag to the string.
echo 'something <br>';
+ 2
UraL , you can concatenate the string with \n in double quotes (look at the code). The second question - "+" sign in PHP is used only for sum with numbers (integers or doubles). It's not used to concatenate strings like in JS. So both of the strings are evaluated as 0 (they are not numbers, however if string begins with number it's different). Hope now everything is clear.
https://code.sololearn.com/wuGlN36q2q6R/?ref=app
0
TheWhÂĄteCat ."\n" is not work
0
TheWhÂĄteCat sorry. Work, but it is displayed on my phone as one space:-(