Why is my constructor still called even if the class and constructor case are different?

前端 未结 4 1830
伪装坚强ぢ
伪装坚强ぢ 2020-12-21 01:58

I am surprised for why the constructor is called when we have different class and constructor name. Constructor name is starting with small \"r\"?

class Regi         


        
4条回答
  •  一向
    一向 (楼主)
    2020-12-21 02:33

    php is case-insensitive (sometimes). The following would work as well:

    CLASS REGISTRATION {
    
        FUNCTION reGISTration(){
            ECHO "constructor is called.";
        }
    }
    
    $obj = NEW Registration();
    

提交回复
热议问题