Answers for "how to delete object php"

PHP
5

delete property from object php

unset($a->new_property);
Posted by: Guest on March-15-2020
0

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;
}
Posted by: Guest on November-02-2020

Browse Popular Code Answers by Language