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

var_export() public static method

Outputs or returns a pars-able string representation of a variable.
public static var_export ( Context ctx, PhpValue variable, bool returnString = false ) : string
ctx Pchp.Core.Context Current runtime context.
variable Pchp.Core.PhpValue The variable.
returnString bool Whether to return a string representation.
return string
        public static string var_export(Context ctx, PhpValue variable, bool returnString = false)
        {
            var output = (new ExportFormatter(ctx, "\n")).Serialize(variable);

            if (returnString)
            {
                // output to a string:
                return output.ToString(ctx);
            }
            else
            {
                // output to script context:
                ctx.Echo(output);
                return null;
            }

        }