Define a class dynamically?
- by Pekka
Is there a way to dynamically and conditionally create a class definition in PHP, i.e.
if (condition matches)
include file containing class definition
else
class myclass extends ancestor_class { .................... }
without eval()?
My background is the accepted answer to this question. I am looking for the best way to build a untouchable core library, with user-defined empty classes extending the core library if necessary.
I want to create the final class definition "on the fly" if there is no user-defined empty class for a certain ancestor class.