PHP: classkit_method_redefine - Manual in Deutsh
PHP: classkit_method_redefine - Manual in French
PHP: classkit_method_redefine - Manual in Polish

You Are At PHP: classkit_method_redefine - Manual Area


recent searches:
include functions , variable functions , post functions...




If you are new to PHP or just need to refresh your skills, this is the place to start. This series of tutorials will give you the basic knowledge you will need to create a simple PHP website.

PHP is a reflective programming language originally designed for producing dynamic web pages.[1] PHP is used mainly in server-side scripting, but can be used from a command line interface or in standalone graphical applications. Textual User Interfaces can also be created using ncurses.

PHP Manual
PrevNext

classkit_method_redefine

(PECL)

classkit_method_redefine -- Dynamically changes the code of the given method

Description

bool classkit_method_redefine ( string classname, string methodname, string args, string code [, int flags] )

Note: This function cannot be used to manipulate the currently running (or chained) method.

Warning

This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.

Parameters

classname

The class in which to redefine the method

methodname

The name of the method to redefine

args

Comma-delimited list of arguments for the redefined method

code

The new code to be evaluated when methodname is called

flags

The redefined method can be CLASSKIT_ACC_PUBLIC, CLASSKIT_ACC_PROTECTED or CLASSKIT_ACC_PRIVATE

Note: This parameter is only used as of PHP 5, because, prior to this, all methods were public.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example 1. classkit_method_redefine() example

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

// create an Example object
$e = new Example();

// output Example::foo() (before redefine)
echo "Before: " . $e->foo();

// Redefine the 'foo' method
classkit_method_redefine(
    
'Example',
    
'foo',
    
'',
    
'return "bar!\n";',
    
CLASSKIT_ACC_PUBLIC
);

// output Example::foo() (after redefine)
echo "After: " . $e->foo();
?>

The above example will output:

Before: foo!
After: bar!

See Also

classkit_method_add()
classkit_method_copy()
classkit_method_remove()
classkit_method_rename()

szkolenia dla księgowych kursy księgowe księgowość
Solidnie i tanio przeprowadzki kraków transport mebli, profesjonalnie
kalkulator kredytu hipotecznego
Prawo jazdy Szczecin
Oryginalne perfumy w promocyjnych cenach

Another Useful functions:


zend-macro.z-obj-class-name-p | zend-api.zend-update-class-constants | zend-api.zend-u-lookup-class | zend-api.zend-u-lookup-class-ex | zend-api.zend-u-fetch-class | zend-api.zend-register-internal-class | zend-api.zend-register-internal-class-ex | zend-api.zend-register-default-classes | zend-api.zend-lookup-class | zend-api.zend-initialize-class-data | zend-api.zend-get-object-classname | zend-api.zend-get-class-entry | zend-api.zend-fetch-class | zend-api.zend-disable-class | zend-api.zend-declare-class-constant | zend-api.zend-declare-class-constant-stringl | zend-api.zend-declare-class-constant-string | zend-api.zend-declare-class-constant-long | zend-api.zend-declare-class-constant-double | zend-api.zend-declare-class-constant-bool | zend-api.zend-cleanup-class-data | zend-api.zend-class-implements | zend-api.get-active-class-name | zend-api.do-bind-inherited-class | zend-api.do-bind-class | zend-api.destroy-zend-class | reserved.classes | ref.classobj | ref.classkit | migration52.classes | migration52.class-constants | function.spl-classes | function.soap-soapserver-setclass | function.runkit-class-emancipate | function.runkit-class-adopt | function.mcal-event-set-class | function.is-subclass-of | function.get-parent-class | function.get-declared-classes | function.get-class | function.get-class-vars | function.get-class-methods | function.dom-domdocument-registernodeclass | function.classkit-method-rename | function.classkit-method-remove | function.classkit-method-redefine | function.classkit-method-copy | function.classkit-method-add | function.classkit-import | function.class-parents | function.class-implements | function.class-exists | function.bcompiler-write-class | function.bcompiler-parse-class | | class.variant | class.dotnet | class.dir | class.com |


PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. If you are new to PHP and want to get some idea of how it works, try the introductory tutorial. After that, check out the online manual, and the example archive sites and some of the other resources available in the links section.