Pchp.Library.Variables.is_callable C# (CSharp) Method

is_callable() public static method

Verifies that the contents of a variable can be called as a function.
public static is_callable ( Context ctx, PhpValue variable, bool syntaxOnly, string &callableName ) : bool
ctx Pchp.Core.Context Current runtime context.
variable Pchp.Core.PhpValue The variable.
syntaxOnly bool If true, it is only checked that has /// a valid structure to be used as a callback. if false, the existence of the function (or /// method) is also verified.
callableName string Receives the name of the function or method (for example /// SomeClass::SomeMethod).
return bool
        public static bool is_callable(Context ctx /*, caller*/, PhpValue variable, bool syntaxOnly, out string callableName)
        {
            var callback = variable.AsCallable();
            if (PhpVariable.IsValidCallback(callback))
            {
                callableName = callback.ToString();
                return true;
            }

            callableName = variable.ToString(ctx);
            return false;
        }

Same methods

Variables::is_callable ( PhpValue variable, bool syntaxOnly = false ) : bool