Pchp.Library.Functions.call_user_func C# (CSharp) Method

call_user_func() public static method

Calls a function or a method defined by callback with given arguments.
public static call_user_func ( Context ctx, IPhpCallable function ) : PhpValue
ctx Pchp.Core.Context Current runtime context.
function IPhpCallable Target callback.
return Pchp.Core.PhpValue
		public static PhpValue call_user_func(Context ctx, IPhpCallable function, params PhpValue[] args)
        {
            if (function == null)
            {
                //PhpException.ArgumentNull("function");
                //return null;
                throw new ArgumentNullException();  // NOTE: should not be reached, runtime converts NULL to InvalidCallback instance
            }

            Debug.Assert(args != null);

            // invoke the callback:
            return function.Invoke(ctx, args);
        }