开发者

possible to use array_map with vprintf?

开发者 https://www.devze.com 2023-02-04 15:30 出处:网络
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 argument

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

精彩评论

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