Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

PHP Interview Questions and Answers

Ques 16. Why doesn't the following code print the newline properly?                 $str = 'Hello, there.nHow are you?
            print $str;
    ?>

Ans.
Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters - and n.

Is it helpful? Add Comment View Comments
Ques 17. Would you initialize your strings with single quotes or double quotes?
Ans. Since the data inside the single-quoted string is not parsed for variable substitution, it's always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution.
Is it helpful? Add Comment View Comments
Ques 18. How come the code <?php print "Contents: $arr[1]"; ?> works, but <?php print "Contents: $arr[1][2]"; ?> doesn't for two-dimensional array of mine? -
Ans. Any time you have an array with more than one dimension, complex parsing syntax is required. print "Contents: {$arr[1][2]}" would've worked.
Is it helpful? Add Comment View Comments
Ques 19. What is the difference between characters 23 and x23?
Ans. The first one is octal 23, the second is hex 23.
Is it helpful? Add Comment View Comments
Ques 20. With a heredoc syntax, do I get variable substitution inside the heredoc contents?
Ans. Yes.
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2016 WithoutBook