To answer this question, we need to understand the differences between the echo()
and print()
functions in PHP.
Option A) echo()
- This option is incorrect because the echo()
function does not return a value. It simply outputs the provided string or variable to the screen.
Option B) print()
- This option is correct because the print()
function returns a value of 1 if the output is successful. It also outputs the provided string or variable to the screen.
Option C) Both - This option is incorrect because although both echo()
and print()
can be used to output values to the screen, only the print()
function returns a value of 1 when the output is successful.
Option D) None - This option is incorrect because the print()
function returns a value of 1 when the output is successful.
Therefore, the correct answer is B) print()
.