public static function alias($aliasName, $callback)
    {
        $err = false;

        if (function_exists($aliasName)) {
            $err = 'This function already' . $aliasName . ' exists';
        }

        if (!is_callable($callback, false, $realfunc)) {
            $err = $callback.' is not callable';
        }

        if($err === false){
            try {
                $bodyFunc = 'function ' . $aliasName . '() {
                    $args = func_get_args();
                    return call_user_func_array("' . $realfunc . '", $args);
                }';

                eval($bodyFunc);

                return array('result' => true, 'msg' => "function $aliasName created from $callback");

            } catch (\Exception $e) {

                $trace = debug_backtrace();

                $msg = sprintf(
                    '%s(): %s in %s on line %d',
                    $trace[0]['function'],
                    $err,
                    $trace[0]['file'],
                    $trace[0]['line']
                );

                trigger_error($msg,
                    E_USER_WARNING
                );

                return array('result' => false, 'msg' => $err);
            }

        } else {
            return array('result' => false, 'msg' => $err);
        }
    }
public static function alias($aliasName, $callback)
    {
        $err = false;

        if (function_exists($aliasName)) {
            $err = 'This function already' . $aliasName . ' exists';
        }

        if (!is_callable($callback, false, $realfunc)) {
            $err = $callback.' is not callable';
        }

        if($err === false){
            try {
                $bodyFunc = 'function ' . $aliasName . '() {
                    $args = func_get_args();
                    return call_user_func_array("' . $realfunc . '", $args);
                }';

                eval($bodyFunc);

                return array('result' => true, 'msg' => "function $aliasName created from $callback");

            } catch (\Exception $e) {

                $trace = debug_backtrace();

                $msg = sprintf(
                    '%s(): %s in %s on line %d',
                    $trace[0]['function'],
                    $err,
                    $trace[0]['file'],
                    $trace[0]['line']
                );

                trigger_error($msg,
                    E_USER_WARNING
                );

                return array('result' => false, 'msg' => $err);
            }

        } else {
            return array('result' => false, 'msg' => $err);
        }
    }
public static function alias ( $ aliasName , $ callback ) { $ err = false ; if ( function_exists ( $ aliasName ) ) { $ err = 'This function already' . $ aliasName . ' exists' ; } if ( ! is_callable ( $ callback , false , $ realfunc ) ) { $ err = $ callback . ' is not callable' ; } if ( $ err === false ) { try { $ bodyFunc = 'function ' . $ aliasName . '() {
                    $args = func_get_args();
                    return call_user_func_array("' . $ realfunc . '", $args);
                }' ; eval ( $ bodyFunc ) ; return array ( 'result' => true , 'msg' => "function $aliasName created from $callback" ) ; } catch ( \ Exception $ e ) { $ trace = debug_backtrace ( ) ; $ msg = sprintf ( '%s(): %s in %s on line %d' , $ trace [ 0 ] [ 'function' ] , $ err , $ trace [ 0 ] [ 'file' ] , $ trace [ 0 ] [ 'line' ] ) ; trigger_error ( $ msg , E_USER_WARNING ) ; return array ( 'result' => false , 'msg' => $ err ) ; } } else { return array ( 'result' => false , 'msg' => $ err ) ; } }
Create an Alias of a function check if it's exist
@param $aliasName
@param $callback
@return array
Create an Alias of a function check if it s exist