Adnan Fajri Adnan Fajri - 1 year ago 101
PHP Question

Array to string conversion error PHP

array(2) {
[0]=> object(stdClass)#460 (1) { ["deskripsi"]=> string(14) "Embedded teeth" }
[1]=> object(stdClass)#461 (1) { ["deskripsi"]=> string(14) "Impacted teeth" }
}


That is my array result after I
vardump
from database query.
Then I want to get text Embedded teeth and Impacted teeth

Can someone please help me?

Answer Source

You have an array of objects, the code below should help point you in the right direction

$objects = $myObj;
foreach($objects as $object){
    echo $object->deskripsi;
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download