Bird
0
0

What does the return statement do inside a PHP function?

easy📝 Conceptual Q11 of 15
PHP - Functions
What does the return statement do inside a PHP function?
AIt declares a new variable inside the function.
BIt prints a value on the screen.
CIt stops the entire script immediately.
DIt sends a value back to where the function was called.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of return

    The return statement sends a value back to the place where the function was called.
  2. Step 2: Differentiate from other actions

    It does not print or stop the whole script; it only ends the function and sends back a value.
  3. Final Answer:

    It sends a value back to where the function was called. -> Option D
  4. Quick Check:

    Return sends value back [OK]
Quick Trick: Return sends value back to caller, not print or stop script [OK]
Common Mistakes:
  • Thinking return prints output
  • Confusing return with exit or die
  • Assuming return declares variables

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes