I'm using this PHP code for creating PHP class with default single variable. But it's not work perfectly.
Note : I need to store data in single variable.
<?PHP
class hello
{
public $data;
}
$test = new hello();
$test->data->user1->name = "Charan";
$test->data->user1->sex = "male";
$test->data->user1->age = "25";
$test->data->user2->name = "Kajal";
$test->data->user2->sex = "female";
$test->data->user2->age = "21";
print_r($test->data->user1);
?>
I got this error :

Please help me , how to fix it ?
user1anduser2data