Bird
0
0

What does the escape sequence \r do inside a PHP double-quoted string?

easy📝 Conceptual Q2 of 15
PHP - Output and String Handling
What does the escape sequence \r do inside a PHP double-quoted string?
AInserts a tab space
BInserts a backslash
CInserts a new line
DInserts a carriage return
Step-by-Step Solution
Solution:
  1. Step 1: Recall escape sequences meaning

    \n is new line, \t is tab, \r is carriage return, \\ is backslash.
  2. Step 2: Match \r to its function

    \r moves the cursor to the beginning of the line (carriage return).
  3. Final Answer:

    Inserts a carriage return -> Option D
  4. Quick Check:

    \r = carriage return [OK]
Quick Trick: Remember \r returns cursor to line start [OK]
Common Mistakes:
  • Mixing \r with \n (new line)
  • Thinking \r inserts tab
  • Confusing \r with backslash

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes