HHVM extension, How to return class -
i declare method variant:
variant hhvm_method(myclass1, get) { object ob; ob.o_set(s_propertyname1, value1, s_myclass2 ); ob.o_set(s_propertyname1, value2, s_myclass2 ); return variant(ob); }
php code:
$c = new myclass1(); var_dump($c->get()); // return stdclass
how create , return myclass2:
var_dump($c->get()); // must return myclass2
when creating object
, need pass in pointer class
object.
variant hhvm_method(myclass1, get) { object ob{unit::loadclass(s_myclass2.get()}; ob.o_set(s_propertyname1, value1, s_myclass2 ); ob.o_set(s_propertyname1, value2, s_myclass2 ); return ob; }
you can see being used in datetime::createfromformat
Comments
Post a Comment