list() php function

The list() function is used to assign values to a list of variables in one operation.

Syntax:

list(var1,var2...)

Example

<?php    $record = array(1 ,'amit', 'math');     
 list($roll, $name, $subject) = $record;     
 echo "roll is $roll<br>name is $name<br>subject is $subject"; 
?>

Output

roll is 1
name is amit
subject is math