Is is possible to overrule PHP’s native functions? In my case looking for a way to overrule the empty() function only within my (own) framework. This is because of auto generated datamodels which seem to ignore my __get() method and __isset() will not always result in valid result.
Can this be done like we also can register multiple autoloaders and create structures with inherited methods from the OOP principles? I only need this to work in the framework.
You should rather write a function yourself that either calls
emptyor does some magic regarding those problematic classes of yours.Or otherwise fix the classes so they work with
empty, but I would choose the first. Many PHP functions dont’t do exactly what you want, so if you got a framework anyway, I would wrap most of them so you always have the possibility to add your own functionality.