超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<vprintfwordwrap>
Last updated: Fri, 22 Jun 2007

vsprintf

(PHP 4 >= 4.1.0, PHP 5)

vsprintf -- Return a formatted string

Description

string vsprintf ( string format, array args)

Return array values as a formatted string according to format (which is described in the documentation for sprintf()).

Operates as sprintf() but accepts an array of arguments, rather than a variable number of arguments.

See also sprintf() and vprintf()




add a note add a note User Contributed Notes
vsprintf
samviseNOSPAM at hobbitonNOSPAM dot it
02-Jul-2002 09:55
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);
}
?>

<vprintfwordwrap>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22