Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- interface Dynamic
- {
- function __call($name, $arguments);
- }
- class Foo
- {
- public function sing()
- {
- var_dump('Do re mi!');
- }
- public function dance()
- {
- var_dump('Cha cha cha!');
- }
- }
- class Bar implements Dynamic
- {
- public function __call($name, $arguments)
- {
- // @todo; magic
- }
- }
- function gimmeFoo(Foo $foo)
- {
- $foo->sing();
- $foo->dance();
- }
- gimmeFoo(new Bar()); // works because Dynamic dodges typechecks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement