🐘 PHP
Beginner
What is the difference between echo and print in PHP?
Answer
Both echo and print are used to output data in PHP, but they have key differences. echo is a language construct (not strictly a function), can accept multiple comma-separated arguments (echo "Hello", " World";), and has no return value — it is marginally faster. print also a language construct, always returns 1, making it usable in expressions: $x = print("Hello");. It accepts only one argument. In practice, echo is used far more commonly. Neither requires parentheses for a single argument, though you can use them for clarity.