I would like to define a class name using variables in PHP. Is it possible?
Let me explain.
I am a small custom CMS that allows the end user to configure a prefix for table names. In this way, the user can define a prefix such as "rc_". The problem is that I have many models that use the table name as a class. For example, if one of my tables rc_posts, the model will be called
class MyModel_Rc_posts extends MyModelController {
}
Is there a way to define a class using variables in PHP WITHOUT use eval(), for example:
class MyModel_{$PREFIX}posts extends MyModelController {
// code here
}
The reason I want to avoid eval is because some of these classes can be quite long. Suggestions appreciated.