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

search for in the

runkit_function_remove> <runkit_function_copy
Last updated: Fri, 13 Nov 2009

view this page in

runkit_function_redefine

(PECL runkit >= 0.7.0)

runkit_function_redefine 関数の定義を新しい実装で置き換える

説明

bool runkit_function_redefine ( string $funcname , string $arglist , string $code )

注意: デフォルトでは、 削除・リネーム・変更が可能なのはユーザ定義関数だけです。組み込み関数を オーバーライドするには、php.inirunkit.internal_override を有効にする必要があります。

パラメータ

funcname

再定義する関数の名前。

arglist

再定義後の関数が受け取る引数のリスト。

code

新しい実装コード。

返り値

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

例1 runkit_function_redefine() の例

<?php
function testme() {
  echo 
"Original Testme Implementation\n";
}
testme();
runkit_function_redefine('testme','','echo "New Testme Implementation\n";');
testme();
?>

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

Original Testme Implementation
New Testme Implementation

参考



add a note add a note User Contributed Notes
runkit_function_redefine
corentin dot delorme at linagora dot com
05-Sep-2007 01:04
Here is another example with a parameter:

<?php

function hello_world($word) {
  echo
"Original Hello World: $word\n</br>";
}

$helloWorld = 'echo "Redefined Hello World: $word\n</br>";';

hello_world('test1');

runkit_function_redefine('hello_world', '$word', $helloWorld);

hello_world('test2');

?>

runkit_function_remove> <runkit_function_copy
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites