list

PHP 4, PHP 5, PHP 7, PHP 8
list - Assign variables as if they were an array
Manual
Code Examples

Example #1 list examples

PHP Version:

Example #2 Using nested list

Result: int(1) int(2) int(3)
PHP Version:

Example #3 list and order of index definitions

Result: array(4) { [2]=> string(1) "a" ["foo"]=> string(1) "b" [0]=> string(1) "c" [1]=> string(1) "d" } string(1) "c" string(1) "d" string(1) "a"
PHP Version:

Example #4 list with keys

Result: id: 1, name: Tom id: 2, name: Fred 2, 4
PHP Version:

Example #5 An example use of list

PHP Version: