Home Answers Viewqa PHP For printing out strings, there are echo, print and printf. Explain the differences.

 
 


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

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

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









Related Pages:
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
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
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
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
echo and print statement
echo and print statement  hello, What is the difference between echo and print statement
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
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  
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
Printing the title of a remote page
Printing the title of the remote page In the following example we have... not open, it will print "unable to open file" and if it becomes successful to open, it will print the title of the page.  <?php $file
Strings
will contain strings which is separated by ",". From the main method invoke... one help me out and reply me soon plzzzzz
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
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/>"
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
printing in swing
printing in swing  How can i print payslip in swing
Print
related objects. It's part of java.lang namespace. out: out being one of those... into the stream and, as opposed to print() method, gets you to the new line after the text
JFrame components printing - Swing AWT
); } } } does it print the rectangle lines and strings what i mentioned above sir and also... errors and i removed that error and i executed program when i press print...(String[] args) { new PrintExample(); } public PrintExample() { super("Printing
JFrame components printing - Swing AWT
); } } } does it print the rectangle lines and strings what i mentioned above sir and also... errors and i removed that error and i executed program when i press print...(String[] args) { new PrintExample(); } public PrintExample() { super("Printing
JFrame Components Printing - Swing AWT
errors and i removed that error and i executed program when i press print... PrintExample() { super("Printing Swing Components... JButton("Print"); printButton.addActionListener(this); JPanel buttonPanel
applet printing
applets gridwise and in each applet i am drawing some graph so while printing whole frame i am able to print all 3 applets together on one page but in each applet i... but while printing it is not getting printed on paper and rest everything
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
printing in java
printing in java  hello i want to print a jInternalframe containing some lebels,but my printer sent me a paper with the following written on it: please what is the problem
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
series printing
series printing  Question:- write a program to print the following series:- 0,1,3,6,15,21,28
series printing
series printing  Question:- write a program to print the following series:- 0,1,3,6,15,21,28
Printing the integers before and after - JSP-Servlet
Printing the integers before and after  Hi, I'm trying to print out the integers before and after generated random number, and also stating it as either even or odd, but it does not seem to work. Pls advise on my code below
Printing a Stack Trace to the Server Console
in a program, it will be better to print out the exception stack trace to catch... Printing a Stack Trace to the Server Console... getMessage() method of the exception to print errors during debugging process
Probblems with printing if my innput of text file is correct..
show me with some code how I can print out what is is labled with <----print...Probblems with printing if my innput of text file is correct..  I am... import java.io.*; import java.util.*; class CitiesDist { //<---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
strings in java
strings in java  please explain me the flow of this program..not able to execute correctly n wats the use of clone public class Strclone { public static void main(String args[]) { String s=new String("a"); String s1
strings 20june
strings 20june  please explain me the flow of this program..not able to execute correctly n wats the use of clone public class Strclone { public static void main(String args[]) { String s=new String("a"); String s1 = "Hello
printing example - Java Beginners
printing example  Is it possible to print java controls using print method? My problem is to print a student mark list using java? The mark list should like that of university mark list
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
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
Printing server information
Printing server information  Hello, I am learning PHP language. I trying to fetch the server Information Print. How could i will printing the server...,   hi, Are you looking for the print server information on the screen
Printing server information
Printing server information This example will teach you how to print the server information on the screen connected to your PC. For printing the server... into PHP code. The PHP code will call the action form to print the server information
Printing username,email Id using session variable.
Printing User Name, Email Id and Address using session variable Using $session() function, we can print user name, email id and address of the user. ...;address"];  echo "Your Email ID is ".$session_email."
how printing landscape?
how printing landscape?  I have code which print some data from data base with "drawString()" and it works correct when I chose "Portrait" from "Print Dialog", but it does not work if chose "Landscape". Is any way to print
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
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
looping with strings
looping with strings  how to print this w we wel welc welco with loop?   import java.util.*; class StringExample3 { public static void main(String[] args) { Scanner input=new Scanner(System.in
php Strings
php Strings       String... in-built functions to use strings. We need to enclose the string within double... print the value directly instead, depends upon the need. We can use both single
Printing ArrayList - JSP-Servlet
Printing ArrayList   I have a code in servlet like this ArrayList total = new ArrayList (); session.setAttribute("efg",total...(request,response); to print the values in ArrayList total, I did this in my JSP
PHP String Function
want to print backslash. In the following example we will also learn about... to mention any single or double quote instead of that all we have to do is after echo... about to print the special characters like \,",' etc. We can freely
how to printing - Java Beginners
how to printing  how to print some thing on output without using system.out.print()and without using print writer class ?  Hi Friend, Try this: import java.io.*; public class Print{ public static void main
Printing 2 arrays
Printing 2 arrays  Hi, I have 2 arrays: String [] head = {"Name", "Date of birth", "PPS number"}; String [] personal= {value1, value2, value3}; I want this 2 arrays to be printed out in the following manner: head[0] tab
Printing Session Id Using Variable
Printing Session Id Using Variable  Hi, I am a learner in PHP language. Could any one guide me, how to print session Id using variable in PHP. Thanks