name);" method; and finally output the deleted data."/> name);" method; and finally output the deleted data.">
Home >Backend Development >PHP Problem >How to delete attributes of an object in php
php method to delete object attributes: first create a PHP sample file; then delete the object attributes through the "unset($user->name);" method; and finally output the deleted data.
Recommended: "PHP Video Tutorial"
PHP Deleting Object Properties
The code is as follows:
<?php define('CLI_SCRIPT', true); $user = new stdClass(); $user->id = 1; $user->name = 'tony'; $user->age = 23; var_dump($user); unset($user->name); var_dump($user);
The above is the detailed content of How to delete attributes of an object in php. For more information, please follow other related articles on the PHP Chinese website!