note 96527 added to functions.anonymous
| From: | AlexanderPodgorny at osu1 dot php dot net | Date: | Wed, 03 Mar 2010 17:22:03 +0000 |
| Subject: | note 96527 added to functions.anonymous | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166584@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 99.55.172.210
----
Manual Page -- http://www.php.net/manual/en/functions.anonymous.php
Edit -- https://master.php.net/note/edit/96527
Del: integrated -- https://master.php.net/note/delete/96527/integrated
Del: useless -- https://master.php.net/note/delete/96527/useless
Del: bad code -- https://master.php.net/note/delete/96527/bad+code
Del: spam -- https://master.php.net/note/delete/96527/spam
Del: non-english -- https://master.php.net/note/delete/96527/non-english
Del: in docs -- https://master.php.net/note/delete/96527/in+docs
Del: other reasons-- https://master.php.net/note/delete/96527
Reject -- https://master.php.net/note/reject/96527
Search -- https://master.php.net/manage/user-notes.php