06.08.2011, 19:51
In the vast majority of cases sprintf is overkill, and PHP offers alternative methods:
PHP allows for variables to be parsed inside strings (like in your example) with double quotes ("), but not single quotes like you are using.
Another method is to use the concatenation operator (full stop) like Farsek suggested.
(I also hope that $svr is sanitized if it is based on any kind of user input!)
PHP allows for variables to be parsed inside strings (like in your example) with double quotes ("), but not single quotes like you are using.
Another method is to use the concatenation operator (full stop) like Farsek suggested.
(I also hope that $svr is sanitized if it is based on any kind of user input!)