print and echo(beginner)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lipun4u
Forum Commoner
Posts: 82
Joined: Wed Jul 01, 2009 3:35 am
Location: Mumbai
Contact:

print and echo(beginner)

Post by lipun4u »

what is the difference between print and echo ???? :oops:
User avatar
Architek
Forum Commoner
Posts: 44
Joined: Wed Jul 01, 2009 5:01 am
Location: Portland OR

Re: print and echo(beginner)

Post by Architek »

I am a newbie as well but I think Print and Echo are the same functions just different syntax between old and newer php releases. I would imagine one is more appropriate to use... I have been using ECHO in most of my code. I am sure a php wiz will chime in and give us the scoop.
BornForCode
Forum Contributor
Posts: 147
Joined: Mon Feb 11, 2008 1:56 am

Re: print and echo(beginner)

Post by BornForCode »

1. Echo works faster than print().
2. Echo and print are language construct.
3. Print behaves as a function and it returns an integer value. For example $value = print "Hello World"; And $value will be 1.
4. Echo does not returns any values.
5. Echo is not suitable for conditional construct
6. Print is suitable for conditional construct. Example: $b ? print "true" : print "false";
7. Print process is slower than echo .
8. Echo can take multiple expressions. You can write echo "first term","second term";

I hope this helps you :)
User avatar
Architek
Forum Commoner
Posts: 44
Joined: Wed Jul 01, 2009 5:01 am
Location: Portland OR

Re: print and echo(beginner)

Post by Architek »

BornForCode wrote:1. Echo works faster than print().
2. Echo and print are language construct.
3. Print behaves as a function and it returns an integer value. For example $value = print "Hello World"; And $value will be 1.
4. Echo does not returns any values.
5. Echo is not suitable for conditional construct
6. Print is suitable for conditional construct. Example: $b ? print "true" : print "false";
7. Print process is slower than echo .
8. Echo can take multiple expressions. You can write echo "first term","second term";

I hope this helps you :)
:drunk:
lipun4u
Forum Commoner
Posts: 82
Joined: Wed Jul 01, 2009 3:35 am
Location: Mumbai
Contact:

Re: print and echo(beginner)

Post by lipun4u »

thanx..... :mrgreen:
Post Reply