adspace


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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to calculate the difference between two dates using php?

1147


if you run the app program all vendor open items are cleared but is it possible to reverse the again again open items please tell me the answer

1994


What does $_files means?

1166


Tell me what kind of things have you done on the social side?

1067


How to create a web form?

1113


Write a program using while loop?

1122


What is difference between static and final in php?

1109


how to detect a mobile device using php

1175


What is trait in php?

1068


sort term descripttion form, report and uery

2254


What sized websites have you worked on in the past?

1089


How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain

1080


Name and explain five of the PHP error constants?

1039


List some features of php that are deprecated in php7?

1024


What is the current stable version of php?

1126