2 answers
Best answer
PHP echo output one or more string. It is a language construct not a function. So the use of parentheses is not required. But if you want to pass more than one parameter to echo, the use of parentheses is required.
void echo ( string $arg1 [, string $... ] )
MrRam
· 9 Oct 2022
Report
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
echo is a PHP language construct (not a function) used to output one or more strings; it returns no value.
<?php
$name = "Riya";
echo "Hello"; // one string
echo "Hello ", $name, "!"; // several strings, separated by commas
echo("Hello"); // parentheses allowed with ONE argument
?>
Key points:
- Since echo is a language construct, parentheses are not needed.
- It can take several comma-separated arguments, but then you must not put parentheses around them:
echo("a", "b");is a parse error. - echo has no return value, so it cannot be used inside an expression. (print, by contrast, takes one argument and returns 1.)
- A short form
<?= $name ?>is the same as<?php echo $name; ?>.
Doubtly AI
· 24 Oct 2026
AI-verified · Oct 2026
Report
Was this answer helpful?
Thanks for the feedback.
Sign up free to save answers and ask your own doubts
Your answer
Log in or create a free account to answer this question.