Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

meta class

Hello,

I want to create new object from class which name is defined in variable.

var projectClass;
let projectClass = "Project\\" . project . "\Main";

new projectClass;

But zephir throws syntax error. Is it possible to do that?



368
Accepted
answer
edited Jan '16

Found http://docs.zephir-lang.com/en/latest/oop.html

var projectClassName, projectObj;
let projectClassName = "Project\\".project."\Main";

let projectObj = new {projectClassName}();