PHP获取数组最后一个元素的键和值
2021-06-16 16:03
阅读:527
标签:技术 info ima soscw image 元素 获取 分享 echo
php /** * PHP获取数组中最后一个元素下标和值 */ $arr = [‘1‘ => ‘name‘, ‘3‘ => 2, 5 => 6, ‘name‘ => ‘张三‘]; $a = end($arr); echo $a; echo "
"; foreach ($arr as $k => $v) { if ($v === $a) { echo $k; } }
PHP获取数组最后一个元素的键和值
标签:技术 info ima soscw image 元素 获取 分享 echo
原文地址:https://www.cnblogs.com/sgm4231/p/9726544.html
上一篇:Python Bs4 回顾
下一篇:python实现排序算法
评论
亲,登录后才可以留言!