I'm working on some PHP right now, and I want it as fast as possible. Naturally, I have to output some interesting stuff; concatenated strings, with integer or floating-point values in them.
The question becomes: is it faster to print values that must be formatted, such as the string "\n", or integers or floating-point numbers, by:
- Including them in one long double-quoted string
- Concatenating them between multiple single-quoted strings
- Using the heredoc format
- Using the sprintf() function
I made a quick PHP script to do the benchmark for me. The results were interesting.
Update 2008-05-02: source code!
Continue reading "PHP String Formatting Performance" »


