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