Skip to content

Instantly share code, notes, and snippets.

@speedmax
Created March 22, 2009 10:28
Show Gist options
  • Save speedmax/83127 to your computer and use it in GitHub Desktop.
Save speedmax/83127 to your computer and use it in GitHub Desktop.
<?php
function extend($object, $class) {
$attr = 'methods';
$$attr = get_class_methods($class);
eval($object.'::$'.$attr.' = $methods;');
}
class Object {
static $methods = array();
}
abstract class ArrayMethods {
function a() {}
function b() {}
}
class A extends Object {
}
extend('A', 'ArrayMethods');
var_dump(Object::$methods);
var_dump(A::$methods);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment