Home > Article > Backend Development > 求解数组序号及所在位置解决思路
求解数组序号及所在位置
$arr = array (<br /> 0 => <br /> array (<br /> 0 => 'SU14031300617',<br /> 'po_num' => 'SU14031300617',<br /> ),<br /> 1 => <br /> array (<br /> 0 => 'SU14031300623',<br /> 'po_num' => 'SU14031300623',<br /> ),<br /> 2 => <br /> array (<br /> 0 => 'SU14031300626',<br /> 'po_num' => 'SU14031300626',<br /> ),<br /> 3 => <br /> array (<br /> 0 => 'SU14031300627',<br /> 'po_num' => 'SU14031300627',<br /> ),<br /> 4 => <br /> array (<br /> 0 => 'SU14031300616',<br /> 'po_num' => 'SU14031300616',<br /> ),<br /> 5 => <br /> array (<br /> 0 => 'SU14031300618',<br /> 'po_num' => 'SU14031300618',<br /> ),<br /> 6 => <br /> array (<br /> 0 => 'SU14031300622',<br /> 'po_num' => 'SU14031300622',<br /> ),<br /> 7 => <br /> array (<br /> 0 => 'SU14031300624',<br /> 'po_num' => 'SU14031300624',<br /> ),<br /> 8 => <br /> array (<br /> 0 => 'SU14031300625',<br /> 'po_num' => 'SU14031300625',<br /> ),<br />)
<br />foreach($arr as $k=>$tmp) {<br /> if('SU14031300617' == $tmp[0]) {<br /> return ($k+1) . '/' . count($arr);<br /> }<br />}<br />return false;<br />