返回 PHP 多维数组中最后一个数组的元素
如何在 PHP 中动态显示最后一个数组中的元素。 例如:
Array ( [0] => Array ( [id] => 6 [user_id] => 8 [category_path] => Sport)
[1] => Array ( [id] => 8 [user_id] => 8 [category_path] => Computers))
为了从最后一个数组返回“id”
8
对于下一个示例
Array ( [0] => Array ( [id] => 6 [user_id] => 8 [category_path] => Sport)
[1] => Array ( [id] => 8 [user_id] => 5 [category_path] => Computers)
[2] => Array ( [id] => 16 [user_id] => 45 [category_path] => Soft))
为了返回
16
谢谢!
How to display an element from the last array dynamically in PHP.
For example:
Array ( [0] => Array ( [id] => 6 [user_id] => 8 [category_path] => Sport)
[1] => Array ( [id] => 8 [user_id] => 8 [category_path] => Computers))
in order to return the "id" from the last array
8
And for the next example
Array ( [0] => Array ( [id] => 6 [user_id] => 8 [category_path] => Sport)
[1] => Array ( [id] => 8 [user_id] => 5 [category_path] => Computers)
[2] => Array ( [id] => 16 [user_id] => 45 [category_path] => Soft))
in order to return
16
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
像这样计算元素并访问它们怎么样?
How about counting the elements and accessing them like this?