PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

runkit_method_redefine> <runkit_method_add
Last updated: Fri, 03 Oct 2008

view this page in

runkit_method_copy

(PECL runkit:0.7-0.9)

runkit_method_copyあるクラスのメソッドを別のクラスにコピーする

説明

bool runkit_method_copy ( string $dClass , string $dMethod , string $sClass [, string $sMethod ] )
警告

この関数は、 実験的 なものです。この関数の動作・ 名前・その他ドキュメントに書かれている事項は、予告なく、将来的な PHP のリリースにおいて変更される可能性があります。 この関数は自己責任で使用してください。

パラメータ

dClass

メソッドのコピー先のクラス。

dMethod

コピー先のメソッド名。

sClass

メソッドのコピー元のクラス。

sMethod

元のクラスからコピーするメソッドの名前。指定されなかった場合は dMethod と同じであるとみなされます。

返り値

成功した場合に TRUE を、失敗した場合に FALSE を返します。

例1 runkit_method_copy() の例

<?php
class Foo {
    function 
example() {
        return 
"foo!\n";
    }
}

class 
Bar {
    
// 最初は、何もメソッドがない
}

// Foo クラスの example() メソッドを Bar クラスに baz() という名前でコピーする
runkit_method_copy('Bar''baz''Foo''example');

// コピーされた関数の出力
echo Bar::baz();
?>

上の例の出力は以下となります。

foo!



add a note add a note User Contributed Notes
runkit_method_copy
There are no user contributed notes for this page.

runkit_method_redefine> <runkit_method_add
Last updated: Fri, 03 Oct 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites