WordPress Support Officer Question: Download WordPress Support Officer PDF

<?php
$str = 'Hello, there.nHow are you?nThanks for visiting Us';
print $str;
?>
Why does not given code print the newline properly?

Tweet Share WhatsApp

Answer:

<?php
$str = 'Hello, there.nHow are you?nThanks for visiting Us';
print $str;
?>
Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters - and n.

Download WordPress Support Officer PDF Read All 31 WordPress Support Officer Questions
Previous QuestionNext Question
How to initialize strings with single quotes or double quotes?How to come code:
<?php print "Contents: $arr[1]"; ?>
works, but
<?php print "Contents: $arr[1][2]"; ?>
doesn't for two-dimensional array of mine?