i wrote a short function that make use of vsprintf. It is useful in first
coding/debugging of php scripts, because it is called like a simple printf
and it display in italic (you can change it of course ;-) ) every debug
messages, making it easy to remove them when your code is
ready.
here goes :
<?php
function printd() {
$debug_array=func_get_args();
$debug_numargs=func_num_args();
$debug_fmt=$debug_array[0];
for ( $i = 0 ; $i <
$debug_numargs ; $i++ )
$debug_array[$i] =
$debug_array[$i+1];
$debug_text=vsprintf($debug_fmt,
$debug_array);
printf("--> debug
<i>%s</i>\n",
$debug_text);
}
?>