Are there pointers in php?

后端 未结 9 1883
余生分开走
余生分开走 2020-11-28 04:06

What does this code mean? Is this how you declare a pointer in php?

$this->entryId = $entryId;
9条回答
  •  一生所求
    2020-11-28 04:24

    PHP can use something like pointers:

    $y=array(&$x);
    

    Now $y acts like a pointer to $x and $y[0] dereferences a pointer.

    The value array(&$x) is just a value, so it can be passed to functions, stored in other arrays, copied to other variables, etc. You can even create a pointer to this pointer variable. (Serializing it will break the pointer, however.)

提交回复
热议问题