Get Instance ID of an Object in PHP

前端 未结 10 1668
说谎
说谎 2020-12-14 07:19

I\'ve learn a while ago on StackOverflow that we can get the \"instance ID\" of any resource, for instance:

var_dump(intval(curl_init()));  // int(2)
var_dum         


        
10条回答
  •  [愿得一人]
    2020-12-14 07:53

    I don't have the PECL runkit enabled to test this, but this may allow you to remove the constructor code from the class definition after the first time that an instance of the class has been created.

    Whether you can remove the constructor from within the constructor would be an interesting experiment.

提交回复
热议问题