【发布时间】:2014-02-24 21:55:42
【问题描述】:
我有一个数组,用于使用 PHPGraphLib 呈现图形。我可以使这项工作正常,但只能使用硬编码值。
我收到来自 Netbeans 的“POSSIBLE syntax error”警告。
将元素附加到这种类型的数组的正确方法是什么?
//Create new graph object and add graph data
$graph = new PHPGraphLib(650,400);
$data = array ("00:00" => -9,
"00:15" => -8,
"00:30" => -3.5,
"00:45" => 5,
"01:00" => 11,
"01:15" => 12.5,
"01:30" => 10.5,
"01:45" => 11,
"02:00" => 2,
"02:15" => -2,
"02:30" => 2,
"02:45" => -2,
"03:00" => 14);
array_push($data, "03:15" => 16); //This is the part I cannot get to work
//Plot data
$graph->addData($data);
【问题讨论】: