For printing out strings, there are echo, print and printf. Explain the differences.

Ads

 
 

Share on Google+Share on Google+

brijesh
For printing out strings, there are echo, print and printf. Explain the differences.
1 Answer(s)      6 years and 6 months ago
Posted in : PHP

For printing out strings, there are echo, print and printf. Explain the differences.

Ads
View Answers

November 15, 2010 at 4:54 PM


Hi everyone,

The basic differences in echo, print, printf is:

echo : echo is a language construct(don't use paranthesis for echo).echo does not return any value.

print : print is also a construct (so parentheses are optional when calling it), but it returns TRUE on successful output and FALSE if it was unable to print out the string.

printf : It is a function, not a construct, and allows such advantages as formatted output, but it?s the slowest way to print out data out of echo, print and printf.

Thanks


Ads









Related Tutorials/Questions & Answers:
For printing out strings, there are echo, print and printf. Explain the differences.
For printing out strings, there are echo, print and printf. Explain the differences.  For printing out strings, there are echo, print and printf. Explain the differences
echo and print statement
echo and print statement  hello, What is the difference between echo and print statement?   hii, echo() can take multiple expressions, Print() cannot take multiple expressions. And echo is a little bit faster
Advertisements
echo and print statement
echo and print statement  hello, What is the difference between echo and print statement
Print or Echo Functions in PHP
Print or Echo Function in PHP Although the use of both Print and Echo are same, but it has been seen that people uses echo command more then the print... that echo is bit faster then print command, as it does not return any value
What is the use of Print or Echo Function in PHP?
What is the use of Print or Echo Function in PHP?  Hi, Can anyone explain what is the use of print or Echo function in PHP? Please provide online reference for this. Thanks,   Hi, Although the use of both Print
How to print differences of two text files
How to print differences of two text files  I have the code to compare 2 different text files, however How can I put the difference of 2 text files in other file or print the difrference in the console?? Thanks
printf and println
printf and println  what is the differences between printf and println?   Hi Friend, The println prints the text on a new line, where as printf prints the text on the same line. Thanks
PHP Introduction to PHP Echo and print Tutorial
forms of outputting: print() and echo(). First... was written for. The first outputting function I will show you is print.... The basic structure of print() is:      <?php  
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print
Print out html markup with h:outputText
Print out html markup with h:outputText  How to print out html markup with h:outputText
"$a dollars" or "{$a} dollars" to print out the amount of dollars.
"$a dollars" or "{$a} dollars" to print out the amount of dollars.  Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example
Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times)
Can u print in turbo C  Can u print in turbo c 9 8 7 6 5 4 3 2 1 0 using pre increment operator Only use print ++a in the same printf() command ten times
echo- Not a function
echo- Not a function       In php generally we use echo command to print something. echo is not a function...: This is multiple line Example: <?php echo "Hello world"."<br/>"
i want print the following out put
i want print the following out put  Hello sir i want the following out put can u provide the program in c# o/p; HELLOLLEH HELLLEH HELEH HEH H
PHP Echo Function
PHP Echo Function As you know echo () is one of the function of php, which is used to show the single or multiple strings on the browser. You can write the echo function as given below… <php Echo “hi how are you
strings
strings  difference between the strings in java and c
Strings
will contain strings which is separated by ",". From the main method invoke... one help me out and reply me soon plzzzzz
WRITE A PROGRAM TO PRINT OUT THE NUBERS 10 THROUGH 49
WRITE A PROGRAM TO PRINT OUT THE NUBERS 10 THROUGH 49   write a program to print out the number 10 through 49 in the following manner 10 11 12 13 ......19 20 21..............29 30 31..............39 40 4142............49
Take print out from printer at client machienusing jsp - JSP-Servlet
Take print out from printer at client machienusing jsp  Sir/Mam I want do is to take out print out of my report which will be created from the Mysql database with out displaying him/her the results or report from the printer
strings
strings  write a program in java to accept two strings as command line arguments and perform the following operations-: 1) compare the strings 2... is an example which accept two strings as command line arguments and perform
write an application that print out the even numbers between the range 100-200
write an application that print out the even numbers between the range 100-200   write an application that print out the even numbers between the range 100-200 ?   The given code accepts the number from 100 to 200
strings
strings   read sentence and convert all the word into capital case like camelcase   Hi Friend, Try the following code: import java.util.*; class ConvertWordsIntoUpperCase { public static String toCamelCase(String
strings
strings  Write a program to initialize 7 names in an array and their respective roll numbers in another array. Search for a roll number input by the user ,in the list ,If found display "Search Successful" and print the name along
strings
the corresponding mathematical operation and print the result. Hint : use the switch
printing in swing
printing in swing  How can i print payslip in swing
Printing stars
Printing stars  I am a beginer and i have one assignment which..." and print o/p as 0 - * 1- ** 2- * 4- ** 5-* 6-* I dont know how to split these strings in java so that i can put it in array..can somebody help
Echo 2
Echo 2       Echo 2 allows you to code Ajax apps in pure Java (Demo)which automatically generates HTML and Javascript. Read full Description
java code for print true if even and false if odd and print error if any float value with out using conditional and looping statement
java code for print true if even and false if odd and print error if any float value with out using conditional and looping statement  hi class Even{ public static void main(String[] arg){ int num=Integer.parseInt
What is 3D Printing?
3D printing is one of those technologies that made manual job with the objects... and in the meantime we lose the erstwhile sense of solid sensory reality. 3D printing... printing is done and what are the benefits of this great manufacturing technology
Differences between session and cookie
Differences between session and cookie  What are the differences between session and cookie?   Session is stored in server but cookie... strings. Cookies are faster than session
Tutorials   
Java Spring Hibernate Struts Training I am Java programmer. Should I learn Java Script or Python? Delete multiple records with pagination by selecting checkboxes How to add one hour in php date? connection in php connection in php connection in php PHP magento how to make previous and next Button Display Data in php session written exam display database results question create a simple form Magento Strings in PHP Zend Framework Installation in xampp? How to prevent adding duplicate items to the shopping cart php problem maximum execution time of 30 seconds exceeded in php Call-time pass-by-reference has been removed in HTTP_POST_VARS is deprecated $_GET[] index is not defined Function mysql_db_query() is deprecated Function mysql_db_query() is deprecated Function split() is deprecated Fatal error: Call to undefined function session_register() in .php file php tag not working Error reporting in PHP Why are MySQL Routines and Views not used with PHP? How to add Click to copy function to my wordpres blog? connection of php to MySQL. loan calculator Datepicker not getting called through include function of php change url string integrate login in php Installation of wamp server Display PHP clock with user input date and time value in div from php, reloading form pre-populate form developing a system using php n mysql Configure apache Tomcat to work with Eclipse and PDT in php How to display a file for 24 hours? LOGIN ERROR LOGIN FAILED", $_SESSION['login fail']='0',}?> I GOT ERROR FOR MY PROJECT PHP Sending emails and insert into trable Tutorial college Student Admission System PLZ HELP ME. i need php code.

Ads

 
Advertisement null

Ads