Answers

Question and Answer:

  Home  WordPress Support Officer

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

<?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.

 148 views

More Questions for you: