In this tutorial learn how to remove value from an array (numeric or associative) in php using unset() method.
function removearrayValue($array, $value)
{
$IsNumericArray = true;
foreach ($array as $key => $item) {
if ($item === $value) {
if (!is_int($key)) {
$IsNumericArray = false;
}
unset($array[$key]);
}
}
if ($IsNumericArray) {
$array = array_values($array);
}
return $array;
}