note 96527 deleted from functions.anonymous by danbrown

From: Date: Wed, 03 Mar 2010 17:26:35 +0000
Subject: note 96527 deleted from functions.anonymous by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166585@lists.php.net to get a copy of this message
Note Submitter: Alexander Podgorny ---- Inspired by the new anonymous functions, I have created a php library that makes the following (javascript-like) syntax possible: <?php class A extends Object {}; A::extend(array( 'method3' => function($owner) { print 'method3'; } )); class B extends Object {}; B::extend('A'); $o1 = Object::construct(); $o1->method1 = function($owner) { return 'method1'; }; $o2 = B::construct(); $o2->method2 = function($owner) { return 'method2'; }; $o2->extend($o1); print $o2->method1(); // output: method1 print $o2->method2(); // output: method2 print $o2->method3(); // output: method3 ?> Read the rest on my blog: http://dot-php.blogspot.com/ Please leave your comments.

« previous php.notes (#166585) next »