Skip to content

Instantly share code, notes, and snippets.

@yqt
Created October 15, 2013 08:07
Show Gist options
  • Save yqt/6988167 to your computer and use it in GitHub Desktop.
Save yqt/6988167 to your computer and use it in GitHub Desktop.
empty(private value) and __isset()
class Test{
private $name = "test";
private $name1 = "test1";
public function __get($name){
echo "__get() triggered! $$name: " . $name . "\n";
return $this->name;
}
public function __isset($tmp){
echo "__isset() triggered! $$tmp: " . $tmp . "\n";;
$ret = isset($tmp);
return $ret;
}
}
$test = new Test();
//var_dump($test->name);
//echo "\n";
var_dump(isset($test->name));
echo "\n";
var_dump(empty($test->name1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment