Bird
0
0

Which output function in PHP returns 1 and also prints it?

easy📝 Conceptual Q2 of 15
PHP - Output and String Handling
Which output function in PHP returns 1 and also prints it?
Aprint
Becho
Cvar_dump
Dprintf
Step-by-Step Solution
Solution:
  1. Step 1: Compare output functions

    echo outputs text but does not return a value. print outputs text and returns 1, so it can be used in expressions.
  2. Step 2: Understand other functions

    var_dump outputs variable info but returns void. printf outputs formatted text and returns the length of output.
  3. Final Answer:

    print -> Option A
  4. Quick Check:

    Output with return value = print [OK]
Quick Trick: print outputs and returns 1, echo only outputs [OK]
Common Mistakes:
  • Assuming echo returns a value
  • Confusing var_dump with output-return functions
  • Thinking printf returns boolean

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes