inaccessible

 

$w = (object)array('key0'=>'a','key1'=>'b',0,1,2,0=>'0w',1=>'1w','11'=>'11str');
var_dump($w);

 

object(stdClass)[4]
  public 'key0' => string 'a' (length=1)
  public 'key1' => string 'b' (length=1)
  public 0 => string '0w' (length=2)
  public 1 => string '1w' (length=2)
  public 2 => int 2
  public 11 => string '11str' (length=5)

 

If an object is converted to an object, it is not   modified. If a value of any other type is converted to an    object, a new instance of the stdClass   built-in class is created. If the value was NULL, the new instance will be   empty.

An array converts to an object with properties   named by keys and corresponding values, with the exception of numeric keys which    will be inaccessible unless iterated.

 

posted @ 2016-09-10 01:32  papering  阅读(295)  评论(0编辑  收藏  举报