How to convert Object into Array in PHP?By Hardik Savani | March 25, 2016 | | 755 Viewer | Category : PHP
Share this post:
Whenever you need to convert object to array in your php project then you can do that using (array). It is a pretty simple example to convert php object into array that way you can use array. So, let's see the following example.
$myObject = new MyClass;
$myObject->id = 100;
$myObject->title = "posts";
$myObject->description = "this is posts";
$newArray = (array) $myObject;
- PHP - I Can't get the $_POST Values on Ajax Request
- Crop, Resize, Frames etc on selected image in php using Aviary
- How to add pagination with union in Laravel 4 and Laravel 5 ?
- How to create custom helper in Laravel 5?
- Laravel 5 - Twitter API using thujohn/twitter composer package tutorial
- How to create Event for Mail sending in Laravel 5.2?
- Laravel 5 login with Linkedin using Socialite Package