Stdclass object to array php codeigniter
i'm using codeigniter, here's my view : Show
and here's app_model -> get_promo_air()
the problem is i can't get $data->result() in my view, when i debug :
i've got :
how to get the value ? coz i try with
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Use this function to convert stdClass Objects into Arrays: Test Results: stdClass Object:
Converted to Array:
Do you need help with a project? or have a new project in mind that you need help with? Contact Me How do you access the stdClass object as an array?Linked. PHP: How to access array element values using array-index.. echo a value in an stdClass Object within an array within an object.. PHP - Convert stdClass Object as String to Array.. Iterate through multidimensional object/array.. ErrorException htmlspecialchars() expects parameter 1 to be string, array given.. What is stdClass object in codeigniter?StdClass means an object that has no specific class. It is "just a basic object". Every object in php start out from a 'basic object' which is then extended with all the characteristics of the specific class that it is an instance of (like Model, Controller, etc).
How do I print a stdClass object?If you just want to print you can use var_dump() or print_r() . var_dump($obj); print_r($obj); If you want an array of all properties and their values use get_object_vars() .
|