|
classkit_method_copy (PECL) classkit_method_copy -- Copies a method from class to another 說明bool classkit_method_copy ( string dClass, string dMethod, string sClass [, string sMethod] ) 警示 | 本函數是實驗性的。本函數的行為,內含函數名稱以及其它任何關於本函數的文件可能會在沒有知會的情況下隨
PHP 以後的發佈而改變。使用本函數風險自擔。 |
參數
- dClass
Destination class for copied method
- dMethod
Destination method name
- sClass
Source class of the method to copy
- sMethod
Name of the method to copy from the source class. If this parameter is
omitted, the value of dMethod is assumed.
返回值
若果成功則返回 TRUE,失敗則返回 FALSE。
範例
例子 1. classkit_method_copy() example
<?php class Foo { function example() { return "foo!\n"; } }
class Bar { // initially, no methods }
// copy the example() method from the Foo class to the Bar class, as baz() classkit_method_copy('Bar', 'baz', 'Foo', 'example');
// output copied function echo Bar::baz(); ?>
|
上例將輸出: |
| |