Extend Class with Final Constructor on PHP

后端 未结 6 1010
栀梦
栀梦 2021-01-06 02:43

I want extend class which have final constructor (in my case it\'s SimpleXMLElement), but i have problems because when i use:

    class myclass extends Simpl         


        
6条回答
  •  轮回少年
    2021-01-06 03:30

    class myclass extends SimpleXMLElement {
       public static function getInstance($xmlversion = '1.0', $xmlencoding = 'ISO-8859-1', $rootName='root') {
          return new self("<$rootName />");
       }
    }
    

提交回复
热议问题