Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the Diff. Between echo() and Print() in PHP?

Answers were Sorted based on User's Feedback



What is the Diff. Between echo() and Print() in PHP?..

Answer / krupa

echo and print are different

Is This Answer Correct ?    7 Yes 2 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / satish

echo is language construct. print is function. echo is
faster. langauge constructs are faster than functions,
always. echo may tek mutiple arguments as well. echo
doesn't give return value.

Is This Answer Correct ?    6 Yes 2 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / arvind pippal

echo is the multiple funtion,print does not multiple
parameters. It is also generally argued that echo is
faster, but usually the speed advantage is negligible, and
might not be there for future versions of PHP.
advantages as formatted output, but it’s the slowest way to
print out data out of echo, print.

Is This Answer Correct ?    13 Yes 10 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / nidz

echo and print both are not functions but a
construct...print can be used as function ...Can anybody
tell me what is construct ?

Is This Answer Correct ?    8 Yes 5 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / pushp

Echo has slight performance advantage because it does not
return value.

Is This Answer Correct ?    7 Yes 4 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / rajiv_cogzidel

echo() doesn't return anything. But print() return true or
false.
You can give output for print() using echo(). You can notice
here print having true. So it give output 1.
Because print is a function. So it return true or false. But
echo is an statement. So it will not.
Ex:-
echo(print(d));
Output:-
d1

But you can't do this using print like this

Ex:-
print(echo(d));

Output:-
Parse error: syntax error, unexpected T_ECHO in
E:\xampp\htdocs\rajiv\valid.php on line 119


And other thing is echo() allow multiple strings using
separated by comma(,).
Here are examples

using echo()
ex:-
echo "Rajiv","\n","K.C","\n","\nHello World!","\nAgain Hello
World!";

output:-
Rajiv K.C Hello World! Again Hello World!

using print()
ex:-
print "Rajiv","\n","K.C","\n","\nHello World!","\nAgain
Hello World!";

output:-
Parse error: syntax error, unexpected ',' in
E:\xampp\htdocs\rajiv\valid.php on line 130

Some one says we cannot use double quotes in single quote.
But it's not true. It will work. Here are examples

print 'print"hai"hoo';
echo 'echo"hai"hoo';

These two give output.

Is This Answer Correct ?    4 Yes 1 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / vinay sachan

There are many differences in print() and echo() :-

1-echo is unformatted whereas print is formatted.

2-echo() can take multiple expressions, Print cannot take multiple expressions.
ex.-
<?php
$name="Vinay";
echo "Name is $name";
//Value is Vinay

print 'Name is $name';
//Value is $name
?>

3-Print return true or false based on success or failure whereas echo just does what its told without letting you know whether or not it worked properly.

Is This Answer Correct ?    3 Yes 0 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / surendra.kandimalla

Echo:echo as a function we can pass only one argument.But echo as command we can pass any number of arguments.echo will not return anything.
echo("echo as function<br>");
echo"arg1","arg2","arg3","<br>";

Print:we can pass only one argument for print as function or command.print returns boolean value.
print("print function<br>");
$b=print"print command<br>";
echo $b,"<br>";

Is This Answer Correct ?    1 Yes 0 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / kunal

print() is a function but echo is statement

Is This Answer Correct ?    57 Yes 57 No

What is the Diff. Between echo() and Print() in PHP?..

Answer / kroonal

echo() have multiple arguments whereas print() have one
arguments. echo() have not any return value whereas print()
return 0 or 1 as per success

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

<?php include ("db.php"); $result = mysql_query("SELECT ques_id FROM questionbank order by ques_id limit 5 "); while($obj=mysql_fetch_array($result)) { $ad1[$obj['ques_id']]++;//Used an array and inserted the database query results into it. } $rand_keys=array_rand($ad1,1); //Did a random array function echo "First random id = ".$ad1[$rand_keys[0]]; echo "<br>Second random id = ".$ad1[$rand_keys[1]]; ?> <!--Its not working. Have any solution for this. -->

1 Answers  


What’s the special meaning of __sleep and __wakeup?

0 Answers  


What is static variable in php?

0 Answers  


I created a cookie with the value like '1A2A',now i want to update this value regularly (about 20 times in a minute) with the value '1A2A3A' , 3A is the new value,new value will vary on the request it may be 3A or 4A or 100A ,some times the cookie is updating with new value but not every time.Can any body suggest the solution

1 Answers  


What backslash character will match whitespace?

0 Answers  


What are the correct and the most two common way to start and finish a PHP block of code?

0 Answers  


What is indexing how many types?

3 Answers   DLF, Infosys, Net Solution, Vcare,


What is the default session time in PHP and how can I change it?

13 Answers   VirtualSoft,


What is a string in php?

0 Answers  


m new to xampp i want to configure file server in xampp... is it possible ??? if so help me....

0 Answers  


How send email using php?

0 Answers  


Which is the best institute in Chennai to learn PHP? Please help.

0 Answers   BPO,


Categories