"Red","b"=>"Green","c"=>"Yellow"); print_r($testarr); unset($testarr[array_search("Green",$testarr)]);//array_search("Green",$testarr)按元素值返回键名。去除后保持索引 print_r($testarr); ?>
查看array_search用法
显示结果去除前:Array([a] => Red[b] => Greed[c] => Yellow)去除后:Array([a] => Red[c] => Yellow)