Jump to content

Why not?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
PHP echo VS print

I noticed a lot of people use echo instead of print when using PHP. Why?

I see the differences for echo vs print

echo -- Output one or more strings
print -- Output a string

To me, it makes sense to use echo only when outputting more than one string.... But why? Why not just do

print "hello" . "there";

#2
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
I really do not know. I use echo just because it was the way I was taught. I think print and echo are almost interchangable.

#3
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
print is a basic command. alot of the commands in php have dups, to make it easier to migrate from one languge to another. For example alot of c commands have been added to php, even though a php alternative already existed for it.

#4
Guest_Chicken_*

Guest_Chicken_*
  • Guests
Well echo is shorter then print, lol.

#5
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
lol by one characeter :(