简体   繁体   English

在PHP中获取关联数组的最后一个键/值对的最快方法是什么?

[英]The fastest way to get the last key/value pair of an associative array in PHP?

What is the fastest way to get the last key/value pair of an associative array in PHP? 在PHP中获取关联数组的最后一个键/值对的最快方法是什么? I know there are some wordy ways to do this. 我知道有一些罗嗦的方法可以做到这一点。 But what's the most concise and efficient way? 但最简洁有效的方法是什么?

end($array); //value
current($array); //another way to get the last value after calling end
key($array); //key (after calling end)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM