How can i “unset” a class that has been declared

前端 未结 4 1186
一生所求
一生所求 2021-01-12 10:38

I have a complete Form Creation System. There are many different Question Types and I have to check if the answer which the person had made is correct.

All types of

4条回答
  •  一向
    一向 (楼主)
    2021-01-12 10:52

    No, it is not possible to "undefine" an existing class.

    In your case, you should not have several classes that all have the same name : each class should have a different / distinct name, and you should modify the way you are working with those, so your code deals with classes not named ItemClass.


    For instance, you could have :

    • ItemClass_Type1 in itemclass_type1.php
    • ItemClass_Type2 in itemclass_type2.php

    and so on -- and those classes could all extend the same base class, if needed / if it makes sense.


    (For a while, I thought maybe runkit could help with the "undefining a class" idea ; but there doesn't seem to be a function to do that -- and that extension is not quite stable and shouldn't be used on a production server)

提交回复
热议问题