Debug functions that will help you:
[...] = optional ... = your value
call dump_vars call dump_functions call args $foo=bar;$x=y;a=1 call execution_time
<!--parser:xtscript-->
function test_function_0 $arg=apple
print $arg ;
endfunction 
function test_function_1 $arg=banana
print $arg ;
endfunction 

# dump of function names
call dump_functions


var $my_var=my value 
var $my_other_var=my other value
var $html = <div>hello</div>;
# dump of variables
call dump_vars

#better dump_vars 
print <br />Better dump_vars<br />
var $dump=call dump_vars
var $dump=call trim $val=$dump ; $charlist={{<pre>
Array/ }}
var $dump=call trim $val=$dump ; $charlist=( )
var $dump=call htmlspecialchars $val=$dump
var $dump=call nl2br $val=$dump
print <div>$dump</div>

#script execution time
 call execution_time
<!--/parser:xtscript-->
Show in textarea
Reload
Array
(
    [0] => test_function_0
    [1] => test_function_1
)
Array
(
    [func] => debugging_tools
    [rnd] => 1178312763
    [url] => 
    [___t] => 
    [__xtblog_rss] => 
    [$my_var] => my value
    [$my_other_var] => my other value
    [$html] => 
hello
)

Better dump_vars

[func] => debugging_tools
[rnd] => 1178312763
[url] =>
[___t] =>
[__xtblog_rss] =>
[$my_var] => my value
[$my_other_var] => my other value
[$html] => <div>hello</div>
0.000001s.