An object is anything that has state and behavior. An object is an instance of a class.
State: name, color, breed
Behavior: sitting, barking, waging tail, running
Objects in PHP:
The concept of objects in php is same as in other programming languages. Objects in php are created with new keyword to instantiate a class.
echo "Doing foo.";
$bar = new foo; //create object of class foo
Delete Objects in PHP:
To delete an object in php we use unset () function that take object as a parameter and delete that object. The unset () function is built in function in php.
$foo = 'bar';
Above is a simple code to delete an object using unset () function in php.
This simple article tells that how we can delete an object using unset () function in php.
Delete an object using unset() function in PHP