CodeIgniter Forums
Using the Logging class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Using the Logging class (/showthread.php?tid=2658)



Using the Logging class - El Forum - 08-16-2007

[eluser]stevefink[/eluser]
Hi all,

I'm having difficulty converting an object to an array so that I can json_encode it. Is there anyway I can use log_message to determine if the following data construct is an object or array?

$data['models'] = $this->autodb->get_models($make_val);

Do I need to throw something like this into my controller:

Code:
if ( is_object( $data['models'] ) )
{
    log_message('info', "message here?");
}

I'm sure the above is an object, because my error logs tell me json_encode can't properly handle it. But I'd like to be able to utilize the logging class to help me debug in the future.

Thanks!