0
我有一個多維數組,我想取代它的timestamp
場..更換多維數組值
Array
(
[new_messages] => 0
[0] => Array
(
[id] => 42
[sender] => 4
[receiver] => 4
[message] => Test
[timestamp] => 1368178683
[read] => 1
[s_deleted] => 0
[r_deleted] => 0
)
[1] => Array
(
[id] => 44
[sender] => 4
[receiver] => 4
[message] => test2
[timestamp] => 1368181485
[read] => 1
[s_deleted] => 0
[r_deleted] => 0
)
)
我運行:
foreach ($messageArray as $key => $row) {
$orderByDate[$key] = $row['timestamp'];
$newTimestamp = date("d-M-Y H:i:s", $row['timestamp']);
$messageArray[$key]['timestamp'] = $newTimestamp;
}
它的工作,取代它,但我得到一個警告:
警告:不能使用標量值作爲數組
爲什麼?以及如何解決它?