开发者

possible to use array_map with vprintf?

Is it possible to开发者_Go百科 use array_map('vprintf', ....)?

If yes, what would be the correct syntax?


You have to provide an array of arrays (the first dimension describing the array of arguments for all elements of $arr, the second describing the values for one format string) as third argument:

<?php

$arr = array("test %s\n", "test2 %s\n");
array_map('vprintf', $arr, array(array('val1'), array('val2')));

Output:

test val1
test2 val2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜