02-07-2012, 11:56 PM | #1 |
Moderator
Join Date: Sep 2011
Location: INDIA
Posts: 250
|
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. |
02-27-2012, 12:55 AM | #2 |
Registered User
Join Date: Feb 2012
Posts: 98
|
|
04-03-2012, 02:00 AM | #3 |
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. |
05-26-2012, 06:28 AM | #4 | |
Registered User
Join Date: May 2012
Location: India
Posts: 64
|
Quote:
Die is used for hide anything in below part during execution. |
|
05-27-2012, 10:35 PM | #5 |
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. |
10-20-2012, 07:01 PM | #6 |
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 |
10-22-2012, 12:12 AM | #7 |
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. |
10-22-2012, 03:54 AM | #8 |
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. |
11-02-2012, 02:58 AM | #9 |
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. |
04-23-2013, 12:00 AM | #10 |
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. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|