我想在一个循环中创建一个这样的数组创建多维数组:在一个循环中
$dataPoints = array(
array('x' => 4321, 'y' => 2364),
array('x' => 3452, 'y' => 4566),
array('x' => 1245, 'y' => 3452),
array('x' => 700, 'y' => 900),
array('x' => 900, 'y' => 700));
与此代码
$dataPoints = array();
$brands = array("COCACOLA","DellChannel","ebayfans","google",
"microsoft","nikeplus","amazon");
foreach ($brands as $value) {
$resp = GetTwitter($value);
$dataPoints = array(
"x"=>$resp['friends_count'],
"y"=>$resp['statuses_count']);
}
但是当循环完成我的数组是这样的:
Array ([x] => 24 [y] => 819)