If you’re looking to create StdClass Objects inline, you’d probably normally do this:

$my_class = new StdClass;
$my_class->variable1 = "test1";
$my_class->variable2 = "test2";

You can put all that into one line using PHP’s casting operator

$my_class = (object) array("variable1" => "test1", "variable2" => "test2");