Laravel output:
Array
(
    [0] = stdClass Object
    (
        [ID] = 5
    )
    [1] = stdClass Object
    (
        [ID] = 4
    )
)
I want to convert this into normal array. Just want to remove that stdClass Object. I also tried using ->toArray(); but I get an error:
Call to a member function toArray() on a non-object.
How can I fix this?
Functionalities have been Implemented on http://www.srihost.com
foreach($yourArrayName as $object)
{
    $arrays[] = $object->toArray();
}
// Dump array with object-arrays
dd($arrays);
Or when toArray() fails because it's a stdClass 
foreach($yourArrayName as $object)
{
    $arrays[] =  (array) $object;
}
// Dump array with object-arrays
dd($arrays);
Not working? Maybe you can find your answer here:
Convert PHP object to associative array
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With