Created
September 30, 2015 14:48
-
-
Save kneipp/aee5802d08505d605676 to your computer and use it in GitHub Desktop.
php 5.6.13 - testing empty and __get() behavior
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
<?php | |
class Xpto | |
{ | |
protected $a = 'a'; | |
public $b = 'b'; | |
public function __get($key) | |
{ | |
echo '__get() '; | |
return $key; | |
//var_dump($key); | |
} | |
} | |
$obj = new Xpto(); | |
var_dump(empty($obj->a)); #bool(true) | |
var_dump($obj->a); # __get() string(1) "a" | |
var_dump(empty($obj->b)); #bool(false) | |
Author
kneipp
commented
Sep 30, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment