Answers for "php stdclass to object array"

PHP
3

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);
Posted by: Guest on August-27-2020
0

convert array to stdclass object in php example

<?php
$empInfo = array(
'name'=>'John',
'address'=>'Houston',
'employment' => array(
    'id' => '1',
    'address' => 'Los Angeles'
    )
);
// or 
$obj = (obj)['name'=> 'Jone Doe'];
print_r(json_decode(json_encode($empInfo)));
Posted by: Guest on October-28-2021

Code answers related to "php stdclass to object array"

Browse Popular Code Answers by Language