I'm trying to setup a function from user code inside a defined object or a class definition but it doesnt seem to work. Am i doing it right? Is there something i need to know... is it even possible?
I know create_function can be used to create a function and it returns the ident to run the function later on, lookup create_function on php.net and it seems possible. Now i wonder if you can actually assign this function inside a class. My final goal is to create a set of functions or objects that will be able to "implement" interfaces to object classes, which is something missing to the PHP language. ------------------ RESULT ------------------ allo Fatal error: Call to undefined function: b() in /home/tech/web/testboard/implements.php on line 21 ------------------------- CODE ------------------------- <?php class cls_a { function a(){ echo 'allo'; } } class impl_a { function get_impl_b(){ return array('', 'echo "Hello world";'); } } $a = new cls_a(); $b_code = impl_a::get_impl_b(); $a->b = create_function($b_code[0], $b_code[1]); $a->a(); $a->b(); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php