如何内爆多个值?
我有以下内爆方法:
$a = array("".$_POST['questionid']."","$qid");
$b = array("".$_POST['AnswerID']."","$ans");
$c = array("".$_POST['timetaken']."","$time");
$comma = implode(",",$a);
echo "$comma";
它给出:
1,2
并打印 a,b 值 $comma = implode(",",$a);
echo "$comma";
$comma1 = implode(",",$b);
echo "$comma1";
它给出:
1,34,2
我如何打印 1,2,3,4
最佳答案
你为什么不自己将 ,
添加到变量 $b
更改自
$comma1 = implode(",",$b);
进入
$b[0] = ",".$b[0];
$comma1 = implode(",",$b);
echo $comma1;
第二种方法 :-
其次,您可以使用
array_merge()
对数组进行 marge,然后您可以通过 implode
对其进行 ,
$comma = implode(",", array_merge($a, $b));
echo $comma;
关于php - 如何内爆多个值?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35217315/