Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cannot assign reference to non referenceable value

Description

It is possible to assign values by references, only when the right operand is already stored in a variable, or similar.

Example

<?php

list(&$x) = [1, 2]; 

$array = [1,2];
list(&$x, ) = $array 

?>

Alternatives

  • Store the operand in a variable (or equivalent).
  • Assign values individually.