Skip to content

Instantly share code, notes, and snippets.

@Ladsgroup
Created August 12, 2016 20:56
Show Gist options
  • Save Ladsgroup/3f3efe2b6493b92b9a0b6bd76b5e1b18 to your computer and use it in GitHub Desktop.
Save Ladsgroup/3f3efe2b6493b92b9a0b6bd76b5e1b18 to your computer and use it in GitHub Desktop.
PHP test for __get()
<?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