php - Why does the "echo" statement support outputting multiple arguments in a single line and the "echo" function does not?


In PHP you can output multiple arguments at once with theecho statement like this:

echo "Mangoes", " ", "are", " ", "tasty.";

When you try to do the same with theecho function like this:

echo("Mangoes", " ", "are", " ", "tasty.");

You get a error, why is this so?
Could this be because PHP wants you to use string concatenation instead of multiple arguments?

Thank you in advance.





when you callecho() its mean you call the function ofecho(). The echo just has one parameterecho(_string_). SO when you include the , sign in the bracket of echo parameter, so it means you make echo function has more than one parameter. So you are not allowed to do like thisecho("Mangoes", " ", "are", " ", "tasty.");

Please see this

People are also looking for solutions to the problem: php - SQL error with custom query (Wordpress)


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.