<?php /** * Created by PhpStorm. * User: Administrator * Date: 2022/4/20/020 * Time: 14:35 */ //数组元素的删除 array_shift() echo"<pre>"; $sanguo=array('shhuguo'=>'liubei','weiguo'=>'caocao','wuguo'=>'sunquan'); $p = array_shift($sanguo); echo $p.'<br>'; var_dump($sanguo); //array-pop() 删除的是最后一个元素 $sanguo=array('shhuguo'=>'liubei','weiguo'=>'caocao','wuguo'=>'sunquan'); $p = array_pop($sanguo); echo $p.'<br>'; var_dump($sanguo); //删除指定的元素 unset() $sanguo=array('shhuguo'=>'liubei','weiguo'=>'caocao','wuguo'=>'sunquan'); unset($sanguo['shhuguo']); var_dump($sanguo); unset($sanguo[0]); var_dump($sanguo); unset($sanguo[1],$sanguo['weiguo']); var_dump($sanguo); echo"<br>"; echo"<br>"; echo"<br>";