Home > Backend Development > PHP Tutorial > 函数赋参数有关问题

函数赋参数有关问题

WBOY
Release: 2016-06-13 12:32:50
Original
784 people have browsed it

函数赋参数问题
如:
php内置的sprintf()函数
例:
sprintf($xml,$a,$b);
我现在还想往后插入参数$c,$d
但是$c,$d是从数组中取出来的数据。
$array=array(
  array('c的内容'),
  array('d的内容'),
)
如果我循环出$array,再放入参数是不可行的,有什么好的方法吗?
$str='';
foreach($array as $key=>$val){
  $str.=$val[0].',';
}
sprintf($xml,$a,$b,$str);

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template