Joomla var_dump equivalent for arrays in a plugin

joomla, joomla2.5, php

Solution

What about this:

JLog::add('The value is: '.print_r($something, true));

Second parameter of print_r() set to true means that it returns a string instead of outputting it

Problem

I have a Joomla plugin that fires after registration. I'm having issues with it but don't know how to debug it properly as the plugin happens only on events. Up to this point I've been using default Joomla logging: ``` jimport('joomla.log.log'); JLog::addLogger(array('text_file' => 'myfile.log.php')); JLog::add('The value is: '.$something); ``` That's fine but not for arrays. How can I dump the contents of an array to a file (or console) to see what is going on? Currently it will just show "Array".

Original source