Shashank Gaurav Shashank Gaurav - 4 months ago 7
PHP Question

How to access object properties in php

My php code is below:

$data['details'] = $this->category_model->edit_category($id);
print "<pre>"; print_r($data); die;


When I am using print my output is:

Array
(
[details] => stdClass Object
(
[id] => 31
[c_parent_id] => 3
[c_name] => Sandles
)

)


I want to access "c_name". How to access it?

Answer

This will print the value:

echo $data['details']->c_name;