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 use empty list

Description

list() must contain at least one non-empty element. Otherwise, it would attempt to load data into no variables, and that makes no sense.

Example

<?php

[,,,] = [1,2,3];
list(,,,) = [1,2,3];

?>

Alternatives

  • Add at least one variable in the list() call.
  • Remove the call to list().