WordPress Question:

Download Job Interview Questions and Answers PDF

Do you know Why doesn’t the following code print the newline properly?

WordPress (CMS) Interview Question
WordPress (CMS) Interview Question

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 (CMS) Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me Would you initialize your strings with single quotes or double quotes?How to call a constructor for a parent class?