note 22853 modified in function.vsprintf by aidan

From: Date: Wed, 09 Jun 2004 13:18:26 +0000
Subject: note 22853 modified in function.vsprintf by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-70457@lists.php.net to get a copy of this message
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); } ?> --was-- 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 : 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); } http://www.php.net/manual/en/function.vsprintf.php

« previous php.notes (#70457) next »