php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12610 vaprintf() and other va_arg functions please!
Submitted: 2001-08-07 01:42 UTC Modified: 2002-06-17 14:05 UTC
From: nutbar at innocent dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
 [2001-08-07 01:42 UTC] nutbar at innocent dot com
I would love to have access to variable length argument functions such as vaprintf(), vasprintf(), etc... so I can easily use func_get_args() in a function and then pass all remaining arguments to a function that can accept arguments in an array format, similar to call_user_func_array, except for non-user defined functions.

Small example:

function tprintf() {
	clearstatcache();
	$arg_list = func_get_args();
	$filename = array_shift($arg_list);
	if (($fd = @fopen($filename, "r"))) {
		rewind($fd);
		$contents = fread($fd, filesize($filename));
		fclose($fd);
	}
	return vaprintf($contents, $arg_list);
}

Thanks in advance!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-18 18:24 UTC] nutbar at innocent dot com
Sorry, should be vprintf() and friends, not vaprintf().  Also, I'm sure this isn't too hard... if I could understand what was going on in the code for call_user_func_array, I'm sure I could make vprintf() at least.

I would really like to see vprintf() at least in the next release of PHP.  Others like vsprintf() or whatever I don't really need right now, but I really need vprintf() badly!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 23:01:30 2024 UTC