Bird
0
0

Which of the following is a valid way to print multiple strings in one print statement in PHP?

easy📝 Conceptual Q2 of 15
PHP - Output and String Handling
Which of the following is a valid way to print multiple strings in one print statement in PHP?
Aprint("Hello", " World");
Bprint "Hello", " World";
Cprint "Hello" . " World";
Dprint "Hello" + " World";
Step-by-Step Solution
Solution:
  1. Step 1: Check concatenation syntax

    In PHP, strings are joined using the dot operator (.) inside print.
  2. Step 2: Validate other options

    Comma-separated or plus operator for strings cause errors or unexpected results.
  3. Final Answer:

    print "Hello" . " World"; -> Option C
  4. Quick Check:

    Concatenate strings with dot = A [OK]
Quick Trick: Use dot (.) to join strings in print [OK]
Common Mistakes:
  • Using commas instead of dot
  • Using plus (+) for string concatenation
  • Trying multiple arguments in print

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes