php remove from object code example
Example 1: delete property from object php
unset($a->new_property);
Example 2: php remove object from array
unset($array[$key]);
// You can do using function when no key
function unsetValue(array $array, $value, $strict = TRUE)
{
if(($key = array_search($value, $array, $strict)) !== FALSE) {
unset($array[$key]);
}
return $array;
}
Example 3: remove field from object php
unset($a->new_property);