
illustrate
1. isset() is a function used to determine whether a variable is set. It passes in a variable as a parameter. If the passed in variable exists, it returns true, otherwise it returns false.
2. It will be automatically called when isset() or empty() is called on an inaccessible property.
Example
<?php
class autofelix
{
private $name = 'autofelix';
public function __isset($name)
{
if(in_array($name, ['name', 'age'])) {
echo $this->name;
} else {
echo 'Not everything can be accessed~';
}
}
}
$a = new autofelix();
isset($a->name);
//Result: autofelixThe above is the use of __isset method in php. I hope it will be helpful to everyone.