PHP developers with a background in C and C++ may frequently be
tempted to use the
printf
function to output strings. While
this works fine, it does cost more in terms of CPU usage than the similar,
yet more basic
print
function. Strictly
speaking print is not a real function but a language construct.
Don't use printf when print is
sufficient. To output simple strings, use print. Generally,
you should only use printf (and sprintf) when
you need more control over the output format, for example, when
formatting integer or floating point numbers for display.