Recall & Review
beginner
What does a return value do in a PHP function?
A return value sends data back from a function to the place where the function was called. It lets the function give back a result.
Click to reveal answer
beginner
How do you return a value from a PHP function?
Use the
return keyword followed by the value you want to send back. For example: return 5;Click to reveal answer
beginner
What happens if a PHP function has no return statement?
The function returns
NULL by default, meaning it does not send any specific value back.Click to reveal answer
intermediate
Can a PHP function return different types of values?
Yes, a PHP function can return any type of value like numbers, strings, arrays, or even objects.
Click to reveal answer
intermediate
What is the effect of a return statement inside a PHP function?
It immediately stops the function and sends the specified value back to the caller.
Click to reveal answer
What keyword is used to send a value back from a PHP function?
✗ Incorrect
The
return keyword is used to send a value back from a function.What does a PHP function return if it has no return statement?
✗ Incorrect
If no return statement is present, PHP functions return
NULL by default.Which of these can a PHP function return?
✗ Incorrect
PHP functions can return any data type including numbers, strings, arrays, and objects.
What happens after a return statement is executed in a PHP function?
✗ Incorrect
A return statement immediately stops the function and sends the value back.
Which of these is NOT a valid return value in PHP?
✗ Incorrect
CSS styles are not valid return values; PHP functions return data types like integers, arrays, or function results.
Explain how the return statement works in a PHP function and why it is useful.
Think about how you get answers from a function after it runs.
You got /4 concepts.
Describe what happens if a PHP function does not have a return statement.
What does the function give back by default?
You got /3 concepts.