Welcome Guest, Not a member yet? Register   Sign In
Using the Logging class
#1

[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!




Theme © iAndrew 2016 - Forum software by © MyBB