从循环中添加数组中的值

时间:2016-08-19 07:14:51

标签: php arrays

如何在数组的代码位置添加多个值。 需要添加以下行

'Destination' => $to,
'Destination' => $to,
'Destination' => $to,
'Destination' => $to

从循环中获取值

$result=mysql_query("SELECT * FROM table");
while($res=mysql_fetch_array($result)){

$mob [] = $res['recepient'];

}

需要添加以下代码

$params = array('Source' => '923158224535', 
                'Destination' => $mob,
                'Mask' => $sender,
                'Message' => $message,
                'UniCode' => $unicode,   
                'Password' => '123');

1 个答案:

答案 0 :(得分:0)

你可以使用:

'Destination' => serialize(array($to,$to1));