To transform a array to stdClass in PHP, try to cast type using (object)
before the array variable.
$arr = ['a' => 1, 'b' => 5];
$obj = (object) $arr;
echo $obj->b;
To transform a array to stdClass in PHP, try to cast type using (object)
before the array variable.
$arr = ['a' => 1, 'b' => 5];
$obj = (object) $arr;
echo $obj->b;
Sound good ?
0 kudos, click the star if you think this post is value !
Read more
about #til