Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要选择特定数组中的最后一个元素。例如,我需要此数组中的最后一个元素,该元素当前设置为第四个或 [3]
end()将返回数组的最后一个元素。
end()
$last = end($categories); echo $last['category_id'];
注意:请注意,这也会设置内部数组指针。