This forum is now read-only. Please use our new forums at

461 points
Submitted by
about 4 years ago

Print and echo?

What is the different between echo and print? And when should i use echo and when should i use print?

66 votes


You can give multiple strings to echo:

echo "This", " string", " was", " made", " with multiple parameters.";

though print can take only one string:

print "This", " string", " was", " made", " with multiple parameters.";
// gives error

echo is marginally faster as compared to print.

print returns 1.

print (print "");
// gives `1` since the inner `print` returned 1 
// which the outer `print` printed

echo does not return anything.

I recommend using echo than print.

That's all to it :)

2570 points
Submitted by
Gaurang Tandon
about 4 years ago


522a6f84548c354fe10003da_800546975 gh0zt about 4 years ago

Thanks for the answer I was wondering this too.

525d8bedabf82129b10018f2_245969237 Josh about 4 years ago

oh thank you!

557ede39d3292f7a0000006a_306960922 wolfie almost 4 years ago

What is print_r(); Can anyone please say? When we use it?

F6f4cd3ba4d981baf0edd3972fa27050?s=140&d=retro Dennis Castro Alonzo about 3 years ago


13 votes


echo() and print() are language constructs in PHP, both are used to output strings. The speed of both statements is almost the same.

echo() can take multiple expressions whereas print cannot take multiple expressions.

Print return true or false based on success or failure whereas echo doesn't return true or false.

324 points
Submitted by
Rias Gremory
almost 4 years ago

8 votes


Basically, when you echo something, you can say lots of things to output. Such as if you were to shout into a cave and hear it ECHO.

Where as printing can only print one thing or expression. Much like a document you print. You can only PRINT the one document, before asking to print another. ;) HOPE THIS HELPED

216 points
Submitted by
over 3 years ago

-18 votes


please check help my site: fxpro

77 points
Submitted by
over 3 years ago

-90 votes


do it yourself stop getting the answers

59 points
Submitted by
michael festekjian
almost 4 years ago


Picture Samuel Martin over 3 years ago

Do what, exactly?

528246b680ff3393e0003430_637958903 Nathaniel over 3 years ago

Find out the difference? I don't know. Maybe that kid has problems....

54d5899686f5521e68003b7b_714393002 MurtazaSadeq over 3 years ago

Do not discourage anyone while they are learning!

54c12e1d9113cb4e8e00209f_576201493 Gouthamm Guru over 3 years ago

Then what are you doing in the forum page?

1fd1601a6654f4f1164c8bc7b19f2358?s=140&d=retro Bryan about 3 years ago