Bird
0
0

You want to output the string "Hello World" using echo and print in one line. Which code correctly does this?

hard📝 Application Q8 of 15
PHP - Output and String Handling
You want to output the string "Hello World" using echo and print in one line. Which code correctly does this?
Aecho "Hello"; print " World";
Becho "Hello", print " World";
Cprint "Hello" echo " World";
Dprint (echo "Hello World");
Step-by-Step Solution
Solution:
  1. Step 1: Check valid usage of echo and print

    Both can be used separately with semicolons to output parts of the string.
  2. Step 2: Identify invalid options

    echo "Hello", print " World"; uses comma between echo and print which is invalid; print (echo "Hello World"); tries to nest echo inside print which is syntax error.
  3. Final Answer:

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

    Separate echo and print with semicolons [OK]
Quick Trick: Use semicolons to separate echo and print statements [OK]
Common Mistakes:
  • Using commas between echo and print
  • Trying to nest echo inside print
  • Missing semicolons

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes