Home  >  Article  >  Backend Development  >  这数组中如何删除指定的键

这数组中如何删除指定的键

WBOY
WBOYOriginal
2016-06-13 11:53:321192browse

这数组中怎么删除指定的键
array (
  'juan_tit' => 
  array (
    0 => '卷一',
    1 => '卷二',
    2 => '卷三',
  ),
)


现在我想删除键名为2的这个值,怎么删除。
------解决方案--------------------

$ar = array (<br />  'juan_tit' => array (<br />    0 => '卷一',<br />    1 => '卷二',<br />    2 => '卷三',<br />  ),<br />);<br />unset($ar['juan_tit'][2]);

------解决方案--------------------
unset($ar['juan_tit'][2]);
------解决方案--------------------
<br />$arr = array(<br />	'juan_tit' => array('卷一','卷二','卷三')<br />);<br />print_r($arr);<br />unset($arr['juan_tit'][2]);<br />print_r($arr);<br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn