Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > PHP / mySQL

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 02-07-2012, 11:56 PM   #1
Spoint_Vinil
Moderator
 
Join Date: Sep 2011
Location: INDIA
Posts: 250
Post Difference between echo,print and die

what are the Differences between echo,print and die ?I havent find any differences.Let me know if such differences exist
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Spoint_Vinil is offline   Reply With Quote

Old 02-27-2012, 12:55 AM   #2
ruixuan
Registered User
 
Join Date: Feb 2012
Posts: 98
see Fibroids Treatment Uterine Fibroids
ruixuan is offline   Reply With Quote
Old 04-03-2012, 02:00 AM   #3
maxsamuel
Registered User
 
Join Date: Mar 2012
Posts: 88
Well I have found 3 major differences between echo and print:

Echo:

1) Does not return value.

2) Faster than 'print'.

3) Can take multiple arguments.

Print:

1) It returns value.

2) Slower than 'echo'.

3) Cannot take multiple arguments.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
maxsamuel is offline   Reply With Quote
Old 05-26-2012, 06:28 AM   #4
spaculus
Registered User
 
Join Date: May 2012
Location: India
Posts: 64
Quote:
Originally Posted by maxsamuel View Post
Well I have found 3 major differences between echo and print:

Echo:

1) Does not return value.

2) Faster than 'print'.

3) Can take multiple arguments.

Print:

1) It returns value.

2) Slower than 'echo'.

3) Cannot take multiple arguments.
your points of difference are very best.

Die is used for hide anything in below part during execution.
spaculus is offline   Reply With Quote
Old 05-27-2012, 10:35 PM   #5
manojob
Registered User
 
Join Date: May 2012
Posts: 420
The differences between Echo and print are:
1. Print has a return value of 1.
2. Print is slow compare to echo.
3. Echo does not return value.
4. Echo is faster compared to print.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
-
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
manojob is offline   Reply With Quote
Old 10-20-2012, 07:01 PM   #6
henryc10
Registered User
 
Join Date: Oct 2012
Posts: 33
Difference between echo and print
1. Speed (echo is slightly faster than print)
2. Parameter (echo can take multiple parameters unlike print)
3. Expression (print can be used as part of more complex expression where echo cannot)

die is another thing which has the same functionality of exit
henryc10 is offline   Reply With Quote
Old 10-22-2012, 12:12 AM   #7
eswari
Registered User
 
Join Date: Aug 2012
Posts: 33
Echo and Print are used for the same functionality printing of data.But there is echo is not a function we cannot pass arguments ,where as print is a function we can pass arguments
die() function prints a message and exits the current script.
ex:
$c=mysql_connect('host','username','pass') or die();
if the mysql connection is unsuccessful then this will die
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
eswari is offline   Reply With Quote
Old 10-22-2012, 03:54 AM   #8
newage123
Registered User
 
Join Date: Jan 2009
Posts: 10
thank you....
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
newage123 is offline   Reply With Quote
Old 11-02-2012, 02:58 AM   #9
Josephsanaya
Registered User
 
Join Date: Nov 2012
Posts: 7
Main difference between echo() and print() is that echo is just an statement not a function and doesn't return's value or it just prints a value whereas print() is an function which prints a value and also it returns value.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Josephsanaya is offline   Reply With Quote
Old 04-23-2013, 12:00 AM   #10
RohanJaiswal
Registered User
 
Join Date: Apr 2013
Posts: 8
echo is used to display the output but it does not return value.
but in print, it return some value.
and die prints the message and exits the current script.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
RohanJaiswal is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:13 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.