我正在努力使这个 PHP 数组转换为我需要的字符串格式。
$result = mysql_query($query) or die(mysql_error());
$result1 = array();
while($row = mysql_fetch_array($result)){
$result1[strtotime($row['DOB'])][strtotime($row['DOB'])] = strtotime($row['DOB']);
$result1[strtotime($row['DOB'])]['PRICE'] += $row['PRICE'];
}
print_r($result1);
当前输出为:
[1136246400] => Array
(
[1136246400] => 1136246400
[PRICE] => 165.5
)
[1136332800] => Array
(
[1136332800] => 1136332800
[PRICE] => 169.5
)
我需要它是:
Array ( [0] => [1136246400, 165.5] [1] => [1136332800, 169.5] )
对 PHP 来说很新 - 任何帮助将不胜感激。谢谢。