note 101280 added to function.runkit-function-copy

From: Date: Tue, 07 Dec 2010 11:57:05 +0000
Subject: note 101280 added to function.runkit-function-copy
Groups: php.notes 
Request: Send a blank email to php-notes+get-174682@lists.php.net to get a copy of this message
If you don`t have this function, yuo can use this: <?php // functions.inc.php : written by Radon8472 (2010-11-16) -- last modified: 2010-12-07 // include guard if( !defined("FUNCTIONS_INC_PHP") ) { define("FUNCTIONS_INC_PHP","1.0"); /** * Copy a function to a new function name * * @author: Radon8472 * @version: 1.0 (2010-12-07) * @link: http://stackoverflow.com questions/1688711/can-we-alias-a-function-in-php * * @param: string $funcname Name of existing function * @param: string $targetname Name of new function to copy definition to * * @return: Returns TRUE on success or FALSE on failure. * @todo: find a way to copy functions with refferece parameters */ function func_alias($funcname, $targetname) { $ok = true; if( !function_exists($funcname) ) $ok = false; if( function_exists($targetname)) $ok = false; if( $ok ) { $command = "function ".$targetname."() { "; $command.= "\$args = func_get_args(); "; $command.= "return call_user_func_array(\"".$funcname."\", \$args); }"; @eval($command); if( !function_exists($targetname) ) $ok = false; } return $ok; } func_alias("func_alias","function_copy"); if(!function_exists("runkit_function_copy")) { func_alias("func_alias","runkit_function_copy"); } } ?> ---- Server IP: 208.69.120.55 Probable Submitter: 92.195.59.170 ---- Manual Page -- http://www.php.net/manual/en/function.runkit-function-copy.php Edit -- https://master.php.net/note/edit/101280 Del: integrated -- https://master.php.net/note/delete/101280/integrated Del: useless -- https://master.php.net/note/delete/101280/useless Del: bad code -- https://master.php.net/note/delete/101280/bad+code Del: spam -- https://master.php.net/note/delete/101280/spam Del: non-english -- https://master.php.net/note/delete/101280/non-english Del: in docs -- https://master.php.net/note/delete/101280/in+docs Del: other reasons-- https://master.php.net/note/delete/101280 Reject -- https://master.php.net/note/reject/101280 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174682) next »