Answers for "convert php array to stdclass object"

PHP
0

php object(stdclass) to array

$array = json_decode(json_encode($object), true);
Posted by: Guest on December-16-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 "convert php array to stdclass object"

Browse Popular Code Answers by Language