Array to Object and Object to Array in PHP - interesting behaviour

后端 未结 2 1779
萌比男神i
萌比男神i 2020-11-30 09:06

Can you explain the next interesting behaviour?

class test {
  //Class *test* has two properties, public and private.
  public $xpublic = \'x1\';
  private $         


        
2条回答
  •  清歌不尽
    2020-11-30 09:37

    Probably the PHP engine conserves the class structure internaly and simply gives some kind of an array wrapper, and thus when you cast it again it remains private, though I can't assure this at 100%.

提交回复
热议问题