+ 1

1. How echo "end of line" ('\n') ? 2. Why echo $var+$car is 0 ?

https://code.sololearn.com/wVo20c8LSGi9/?ref=app

29th Jul 2019, 6:55 PM
UraL
4 odpowiedzi
+ 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>';
29th Jul 2019, 7:20 PM
Johann
Johann - avatar
+ 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
29th Jul 2019, 7:27 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
TheWh¡teCat ."\n" is not work
29th Jul 2019, 7:41 PM
UraL
0
TheWh¡teCat sorry. Work, but it is displayed on my phone as one space:-(
29th Jul 2019, 7:46 PM
UraL