The list() function assigns variables as if they were an array. It returns the assigned array.
Syntax
list(variable1, variable2, variable 3, ...)
Parameters
variable1 − the first variable
variable2 − more variables
variable3 − more variables
Return
The list() function returns the assigned array.
Example
The following is an example −
<?php
$arr = array("David","Jack");
list($one, $two) = $arr;
echo "Selected candidates: $one and $two.";
?>Output
The following is the output −
Selected candidates: David and Jack.