· 1 min read

How to Cast an Array to an Object with PHP

It's short and sweet.

$obj_from_array = (object)['key'=>'val'];

echo $obj_from_array->key;

Comments

Leave a comment