PHP 4, PHP 5, PHP 7, PHP 8
list - Assign variables as if they were an array
list( mixed$var, [ ... mixed$vars] ): array
Like array, this is not really a function, but a language construct. list is used to assign a list of variables in one operation. Strings can not be unpacked and list expressions can not be completely empty.
Before PHP 7.1.0, list only worked on numerical arrays and assumes the numerical indices start at 0.
Returns the assigned array.
|7.3.0||Support for reference assignments in array destructuring was added.|
|7.1.0||It is now possible to specify keys in list. This enables destructuring of arrays with non-integer or non-sequential keys.|
Show all examples for list