Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Globals implements ArrayAccess {
- public function offsetGet($key) {
- return 'Yupp!';
- }
- public function offsetSet($key, $value) {}
- public function offsetUnset($key) {}
- public function offsetExists($key) {}
- }
- $GLOBALS = new Globals();
- function test_globals() {
- echo $GLOBALS['nonexistent value']; // echoes "Yupp!"
- }
- test_globals();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement