• XEN DEVELOPMENT is a developer's resource for new developers wanting to build XenForo 2 add-ons. Experienced developers are also welcome to share their experienes and knowledge. This site is not affiliated with XenForo or a replacement for the official XenForo developer forums.

Beginners Getting Information Returned (Dump a Variable)

LPH

Flight Director
Staff member
There are several ways to get information about a variable, an array, or an object.

var_dump
The best way to begin is to use var_dump after calling the variable.

PHP:
var_dump( $variable );
var_dump.png

Another trick is to simply add an exit; line after the var_dump.

print_r
Inserting print_r( $variable ) provides a cleaner view of the variable or array.

print_r.png

XenForo Specific
XenForo developers provide two simple ways to dump a variable.

PHP:
\XF::dump($var);
\XF::dumpSimple($var);
XF dump.png
 
Top