🎴 Flashcard Mode

Basic PHP Quiz 2

Card1 / 10
Mastered0
Review0
QuestionClick to flip

What is the difference between print() and echo()?

AnswerClick to flip back
A
print() can be used as part of an expression, while echo() can't
💡 Explanation:

In PHP, print() returns a value (1), allowing it to be used in expressions (e.g., if (!print('a'))). echo() does not return anything and outputs the string directly, making it invalid within complex expressions requiring a return value.

Change Mode