<?php
$messages = mysql_query("SELECT * FROM privatemessages WHERE nodeview='$_GET[nodeview]' ORDER BY id ASC LIMIT 5 OFFSET $_GET[offset]");
while($message = mysql_fetch_array( $messages )) {
$user = mysql_query("SELECT * FROM users WHERE id='$message[senderuserid]' ");
$user = mysql_fetch_array($user);
$rows[] = $message[message];
}
print_r($rows);
array_reverse($rows);
print_r($rows);
?>
为什么它会反转某些数组而不反转其他数组呢?
答案 0 :(得分:7)
array_reverse - 返回一个包含反向元素的数组
它返回反转的数组,但不会“就地”反转它
$rows = array_reverse($rows);