Bug #14112 Updated: sprintf_array()

From: Date: Mon, 19 Nov 2001 13:00:58 +0000
Subject: Bug #14112 Updated: sprintf_array()
References: 1  Groups: php.dev php.doc 
Request: Send a blank email to php-dev+get-70906@lists.php.net to get a copy of this message
ID: 14112 User updated by: lenar@vision.ee Reported By: lenar@vision.ee Old Status: Closed Status: Open Old Bug Type: Feature/Change Request Bug Type: Documentation problem Operating System: Linux PHP Version: 4.1.0RC1 New Comment: Not finding anything about those functions [vprintf(), vsprintf()] in documentation.. Previous Comments: ------------------------------------------------------------------------ [2001-11-19 07:11:34] zak@php.net Poof! Apparently Andrei is prescient. :) Use vprintf() and vsprintf() to do exactly what you requested. ------------------------------------------------------------------------ [2001-11-19 07:09:54] lenar@vision.ee Your solution seems fine to me. It doesn't change the functionality I requested, so no objections. ------------------------------------------------------------------------ [2001-11-19 06:47:50] zak@php.net I would guess that implementing it as a native PHP function would be at least 2x as fast. I suppose the issue now is finding out if the core PHP developers consider the function to have enough value to add it. My personal, non-core developer, opinion is that I don't like the idea of adding this function. Perhaps instead we could overload the current implementations of printf and sprintf so that they can accept a single-dimension array as the second parameter (and in this case, final, parameter)? ------------------------------------------------------------------------ [2001-11-19 06:11:24] lenar@vision.ee Yes something like this should work. But it's not as fast as it could be. And I personally like when thins are as fast as possible. ------------------------------------------------------------------------ [2001-11-19 05:53:41] zak@php.net Why not just build your own function? function sprintf_array ($format) { if (1 == func_get_args () ) { return sprintf ($format); } $argv = func_get_args (); return call_user_func_array ('sprintf', $argv); } (Not tested, but something like this should work. :) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/?id=14112 Edit this bug report at http://bugs.php.net/?id=14112&edit=1

« previous php.dev (#70906) next »