<?php /** * PHP获取数组中最后一个元素下标和值 */ $arr = [‘1‘ => ‘name‘, ‘3‘ => 2, 5 => 6, ‘name‘ => ‘张三‘]; $a = end($arr); echo $a; echo "<br>"; foreach ($arr as $k => $v) { if ($v === $a) { echo $k; } }
原文地址:https://www.cnblogs.com/sgm4231/p/9726544.html
时间: 2024-09-28 23:53:25