Home  >  Article  >  Backend Development  >  这数组中怎么删除指定的键

这数组中怎么删除指定的键

WBOY
WBOYOriginal
2016-06-23 13:59:43799browse

array (
  'juan_tit' => 
  array (
    0 => '卷一',
    1 => '卷二',
    2 => '卷三',
  ),
)


现在我想删除键名为2的这个值,怎么删除。


回复讨论(解决方案)

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

unset($ar['juan_tit'][2]);

$arr = array(	'juan_tit' => array('卷一','卷二','卷三'));print_r($arr);unset($arr['juan_tit'][2]);print_r($arr);

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