breux / prototype
该软件包已被 废弃 并不再维护。未建议替代包。
PHP 5.4 - Prototype
1.0
2013-01-06 18:17 UTC
Requires
- php: >=5.4.1
This package is not auto-updated.
Last update: 2020-01-24 14:47:10 UTC
README
在 PHP 5.4 中玩原型!
示例
类
class Foo { use Prototype\Prototype; }
将原型添加到对象(及其他对象)
$foo = new Foo; $foo->saidHello = function($lastName) { return "Hello $lastName"; }; echo $foo->saidHello('Julien');
将原型添加到类(针对所有对象)
Foo::prototype('saidHello', function($lastName) { return "Hello $lastName"; });
用法
$bar = new Foo; echo $bar->saidHello('Laura');