Question

OK, it's my first try with ColdFusion and I'm having some serious trouble.

I just tried

writeDump(someVar);

within a <cfscript> block, and it keeps throwing errors.

What's going on?


P.S. What I'm trying to do is something similar to php's print_r or var_dump; so if you know of a better/alternative way to achieve the very same thing, I'm all ears! :-)

Was it helpful?

Solution

Taking James's idea forward, what is your CF version, because writedump will work only in version 9 & later. If you are on version 8 or earlier, you have to use <cfdump var="#someVar#">

If you have to use it in cfscript, then you can write your own custom function

<cffunction name="myDump" returntype="void">
    <cfargument name="arg" required="true" type="any">
    <cfdump var="#Arguments.arg#">
</cffunction>

and then call this function inside cfscript block

mydump(somevar);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top