Created
August 12, 2016 20:56
-
-
Save Ladsgroup/3f3efe2b6493b92b9a0b6bd76b5e1b18 to your computer and use it in GitHub Desktop.
PHP test for __get()
This file contains hidden or 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 A { | |
public $d; | |
public function __get( $attribute ) { | |
throw new Exception( "Accessing non-existent parameter: $attribute" ); | |
} | |
} | |
$a = new A(); | |
$a->d = 'ff'; | |
var_dump( isset( $a->b )); | |
var_dump( isset( $a->d )); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment