PHP Echo vs Printf

julielima

New member
This question must be very easy for experience PHP programmers but i am completely new to programming and am therefore requesting in this forum to kindly tell me the difference between the two PHP functions Echo and function printf. I have tried to use both of them one by one on a few line PHP code and both of these functions are giving me the same output.

I am unable to understand the difference between the functions and wondering if both of the functions printf and echo are giving me the same output then which of them must be used more often and if there are any benefits of using one over the other. Also i would appreciate if any one can compare if there are any other difference in using echo vs printf function of php.
 
Printf() is a function while echo is a language construct. There really isnt much difference between the two in my opinion. Using echo is my preference as you do not need to use ( ) since it is not a function. If speed is a concern, echo tends to load faster as well but that is not much of a concern for most websites. Hope this helps.
 
The difference is that echo sends a newline at the end of its output. There is no way to "send" an EOF.
 
Marriage Sites | online marriage bureau | Matrimonial Sites in Ludhiana

Printf and echo there are different language language use the Print the message . Printf is used c language It is base language. Every language is some different some and regulation. echo is used to php. Php is stand for the personal home page. It is way of the show on the out put on the screen.
 
The main difference is that printf receives first a format string..
Echo is, instead, just displaying the string.
 
Back
Top