Created
October 15, 2013 08:07
-
-
Save yqt/6988167 to your computer and use it in GitHub Desktop.
empty(private value) and __isset()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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