//Array after (object)
$clasa = (object) array(
'e1' => array('nume' => 'Nitu', 'prenume' => 'Andrei', 'sex' => 'm', 'varsta' => 23),
'e2' => array('nume' => 'Nae', 'prenume' => 'Ionel', 'sex' => 'm', 'varsta' => 27),
'e3' => array('nume' => 'Noman', 'prenume' => 'Alice', 'sex' => 'f', 'varsta' => 22),
'e4' => array('nume' => 'Geangos', 'prenume' => 'Bogdan', 'sex' => 'm', 'varsta' => 23),
'e5' => array('nume' => 'Vasile', 'prenume' => 'Mihai', 'sex' => 'm', 'varsta' => 25)
);
<?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)));