📜  php 按值而不是键删除数组项 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:27.236000             🧑  作者: Mango

代码示例1
$colors = array("blue","green","red");

//delete element in array by value "green"
if (($key = array_search("green", $colors)) !== false) {
    unset($colors[$key]);
}