Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php stdclass to array

// The manual specifies the second argument of json_decode as:
//	 assoc
//		When TRUE, returned objects will be converted into associative arrays.


$array = json_decode(json_encode($booking), true);
Comment

convert stdclass object to array php

$person = new stdClass();
$person->firstName = "Taylor";
$person->age = 32;

//Convert Single-Dimention Object to array
$personArray = (array) $person;

//Convert Multi-Dimentional Object to Array
$personArray = objectToArray($person);
function objectToArray ($object) {
    if(!is_object($object) && !is_array($object)){
    	return $object;
    }
    return array_map('objectToArray', (array) $object);
}
Comment

php object(stdclass) to array

$array = json_decode(json_encode($object), true);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel collection remove duplicates 
Php :: laravel create project command 
Php :: codeigniter form_validation email 
Php :: Problem 1 - phpspec/prophecy is locked to version 1.13.0 and an update of this package was not requested. - phpspec/prophecy 1.13.0 requires php ^7.2 || ~8.0, <8.1 - your php version (8.1.2) does not satisfy that requirement. 
Php :: download speed limit php 
Php :: how to document php api with swagger 
Php :: run laravel mix 
Php :: show selected value in dropdown laravel 
Php :: fore install debian 10 php 7.3 
Php :: laravel create migration add column 
Php :: laravel inverse seeder 
Php :: php date to seconds 
Php :: default index page for laravel in cpanel 
Php :: grouping routes in laravel 
Php :: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108872 bytes) in phar:///usr/local/bin/composer1.phar/src/Composer/DependencyResolver/RuleSet.php on line 8 
Php :: datetime iso 8601 php 
Php :: laravel print query with parameters 
Php :: php konstanten 
Php :: php artisan up 
Php :: running a laravel app locally 
Php :: php usort keep keys 
Php :: create empty 2d array php 
Php :: get raw query laravel 
Php :: curl exec not working php 
Php :: wpdb-prepare 
Php :: pdo last id 
Php :: laravel password validation 
Php :: server error in laravel 
Php :: To store data in the session Laravel 
Php :: How to pass JavaScript variables to PHP? 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =