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

Answer from Maurice on Stack Overflow
🌐
ItSolutionstuff
itsolutionstuff.com › post › how-to-convert-object-to-array-in-laravel-5example.html
How to Convert Object to Array in Laravel? - ItSolutionstuff.com
April 16, 2024 - If you require to convert object data from db into array then you can do it using DB facade and Model Eloquent. Sometimes we need to give array data only so we must get array data from db.
Discussions

laravel - How to convert an object properties into an array in php - Stack Overflow
You may cast an object to be an array as @MoussabKbeisy said. And this would be the easiest way: ... while this is a PHP Object so you can deal with it by 2 ways: 1- if you want to get on of it's parameters, you can simply use More on stackoverflow.com
🌐 stackoverflow.com
php - How to convert object as array Laravel 4.2 - Stack Overflow
You haven an object and you can transform it to and array. ... You can find this method in the Laravel documentation. ... Save this answer. ... Show activity on this post. If you run into problems, this will give you a pure PHP solution. More on stackoverflow.com
🌐 stackoverflow.com
php - Laravel Object to Array - Stack Overflow
I try for some time to use an array instead of a collection, as Laravel does. I tried to do this method, without success: Event::listen(StatementPrepared::class, function ($event) { $event-> More on stackoverflow.com
🌐 stackoverflow.com
php - Converting object to array in laravel - Stack Overflow
You can check the solution to this SO question. It explains how to convert an object to an array. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Laracasts
laracasts.com › discuss › channels › laravel › how-to-convert-an-array-to-object-in-php
How to convert an array to object in PHP
Another option would be to instantiate a standard class as a variable, and loop through your array while re-assigning the values: $object = new stdClass(); foreach ($array as $key => $value) { $object->$key = $value; }
🌐
Laracasts
laracasts.com › discuss › channels › laravel › json-format-transform-from-object-to-array
Json format transform from object to array
March 18, 2025 - To transform a JSON object into an array in Laravel, you can use the toArray() method provided by Eloquent models.
🌐
Medium
medium.com › laravelnepal › convert-your-deeply-nested-objects-to-array-50b3286bc323
Convert your deeply nested objects to array | by Suman Shrestha | laravelnepal | Medium
October 25, 2017 - To convert deeply nested objects to array, we can simply use json functions provided by php. json_encode and json_decode are two of them. $array = json_decode(json_encode($object), true); Here, second parameter asks to turn your object to ...
🌐
Laracasts
laracasts.com › discuss › channels › general-discussion › cast-array-to-an-object-in-controller-and-the-pass-to-view
Cast Array to an Object in Controller and then pass to View
I couldn't understand earlier why it didn't work before, I just thought Laravel was treating it differently than expected and I couldn't understand why, but it wasn't even the problem in the first place, ha. And just for any one else reading, it's of course possible to inline it like usual: $page = (object) array( 'title' => 'Hello World', 'template' => 'welcome', );
Find elsewhere
🌐
Upgrad
upgrad.com › home › blog › software development › how to convert object to array in php? techniques and examples
How to Convert Object to Array in PHP – Quick & Simple Methods
September 10, 2025 - Let's say you’re working with a PHP-based e-commerce platform like Shopify, where customer data is retrieved via an API in object format. You need to manipulate this data, maybe to display it on a dashboard or process it for analysis, but it's much easier to work with arrays.
🌐
Laracasts
laracasts.com › discuss › channels › eloquent › eloquent-results-as-array-instead-of-object
Eloquent results as array instead of object
Like Reply · cipsas · 9 years ago · Level 10 · ReplyReport Spam · You can use ->toArrayl() method: https://laravel.com/docs/5.4/collections#method-toarray · Like Reply · 1 like · Mittensoff · 9 years ago · Level 3 · ReplyReport Spam ...
🌐
Laracasts
laracasts.com › discuss › channels › laravel › how-to-convert-this-collection-to-an-array
How to convert this collection to an array ?
How will i convert it into a proper array. please assist. muragijimana · 10 years ago · Best Answer · Level 4 · ReplyReport Spam · Hello you can do something like this · $collection = collect(['name' => 'Desk', 'price' => 200]); $collection->toArray(); Reference is https://laravel.co...
🌐
Edureka
edureka.co › blog › convert-object-to-array-in-php
How To Convert Object To Array In PHP | PHP Fundamentals | Edureka
September 20, 2019 - JSON encoded string is accepted by json_decode function and converts it into a PHP variable and on the other hand, JSON encoded string for a given value is returned by json_encode · Syntax: $Array_var = json_decode(json_encode($obj), true) Below ...
🌐
Laravel
laravel.com › docs › 13.x › eloquent-serialization
Eloquent: Serialization | Laravel 13.x - The clean stack for Artisans and agents
You may also convert entire collections of models to arrays by calling the toArray method on the collection instance: ... To convert a model to JSON, you should use the toJson method.
🌐
Spatie
spatie.be › docs › laravel-data › v4 › as-a-resource › from-data-to-array
From data to array | laravel-data | Spatie
By default, calling toArray on a data object will recursively transform all properties to an array. This means that nested data objects and collections of data objects will also be transformed to arrays.
🌐
Laravel
laravel.com › docs › 4.2 › helpers
Helper Functions | Laravel 4.2 - The clean stack for Artisans and agents
Use object_get. The array_only method will return only the specified key / value pairs from the array.
🌐
Laracasts
laracasts.com › discuss › channels › laravel › php-push-two-object-to-an-array
Php (Push two object to an array)
$calender_config_info = auth()->user()->business->calender_config; $id = auth()->user()->business->id; $employeeInfo = Employee::where('business_id', $id)->get(); foreach($employeeInfo as $info){ $employeeInfo = array( 'id' => $info['id'], 'role' => $info['role'], ); } //dd($employeeInfo); $employee_list = []; foreach ($calender_config_info as $info) { $employee = array( 'name' => $info['info']['Employee'] ); array_push($employee_list, $employee); } //dd($employee_list); so i have the values but i don't know how to push it in the right way.