Bird
0
0

What is the return value of print in PHP?

easy📝 Conceptual Q2 of 15
PHP - Output and String Handling
What is the return value of print in PHP?
AIt returns the number of characters printed.
BIt returns 1 after printing the string.
CIt returns true if printing succeeds, false otherwise.
DIt returns nothing (void).
Step-by-Step Solution
Solution:
  1. Step 1: Recall print behavior

    print outputs the string and returns 1 always.
  2. Step 2: Differentiate from other return types

    It does not return the number of characters or a boolean, just integer 1.
  3. Final Answer:

    It returns 1 after printing the string. -> Option B
  4. Quick Check:

    print return value = 1 [OK]
Quick Trick: Remember print returns 1 after output [OK]
Common Mistakes:
  • Assuming print returns number of characters
  • Thinking print returns true/false
  • Believing print returns nothing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes