向数组中增加值
<?php
$minren = array(
'杨幂',
'王珞丹',
'刘亦菲',
'黄圣依'
);
$minren[] = '范冰冰';
$minren[100] = '范爷';
$minren[] = '李晨';
echo '<pre>';
var_dump($minren);
echo '</pre>';
?>
输出结果:
array(7) {
[0]=>
string(6) "杨幂"
[1]=>
string(9) "王珞丹"
[2]=>
string(9) "刘亦菲"
[3]=>
string(9) "黄圣依"
[4]=>
string(9) "范冰冰"
[100]=>
string(6) "范爷"
[101]=>
string(6) "李晨"
}
删除数组中的值
<?php
$minren = array(
'杨幂',
'王珞丹',
'刘亦菲',
'黄圣依',
'范冰冰'
);
unset($minren[3]);
$minren[] = '金星';
echo '<pre>';
var_dump($minr