if (($key = array_search('strawberry', $array)) !== false) {
unset($array[$key]);
}
$array = array('apple', 'orange', 'strawberry', 'blueberry', 'kiwi', 'strawberry'); //throw in another 'strawberry' to demonstrate that it removes multiple instances of the string
$array_without_strawberries = array_diff($array, array('strawberry'));
print_r($array_without_strawberries);
$array=array_diff($array,['strawberry']);
if (($key = array_search('strawberry', $array)) !== false) {
unset($array[$key]);
}
$Array = array('Dog' , 'Cat' , 'Bird');
$count = count($Array);
for ($x = 0; $x < $count; $x++) {
if ($Array[$x] == 'Cat'){
//If
array_splice($Array, $x, 1);
$x = $x - 1;
$count = $count - 1;
}
}