runkit_function_redefine

(PECL runkit >= 0.7.0)

runkit_function_redefine Replace a function definition with a new implementation

说锟斤拷

runkit_function_redefine ( string $funcname , string $arglist , string $code [, bool $return_by_reference = NULL [, string $doc_comment = NULL ]] ) : bool
runkit_function_redefine ( string $funcname , Closure $closure [, string $doc_comment = NULL ] ) : bool

Note: 默锟斤拷锟斤拷锟斤拷拢锟斤拷锟斤拷锟斤拷没锟斤拷占锟斤拷删锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟睫改猴拷锟斤拷锟斤拷为锟剿革拷锟斤拷锟节诧拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 php.ini 锟叫碉拷 runkit.internal_override 锟斤拷锟矫★拷

锟斤拷锟斤拷

funcname

Name of function to redefine

arglist

New list of arguments to be accepted by function

code

New code implementation

closure

A closure that defines the function.

return_by_reference

Whether the function should return by reference.

doc_comment

The doc comment of the function.

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
runkit 1.0.4 An alternative syntax expecting a closure has been added.
runkit 1.0.4 The optional parameters return_by_reference and doc_comment have been added.

锟斤拷锟斤拷

Example #1 A runkit_function_redefine() example

<?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

锟轿硷拷