what is list in php?

Last updated 5 years, 1 month ago | 1368 views 75     5

Tags:- PHP


List is a language construct and is similar to an array. It is used to assign a list of variables in one operation. If you are using PHP 5, then the list values start from a right parameter, and if you are using PHP 7, then the list starts with left parameter.


$info = array('red', 'sign', 'danger');

// Listing all the variables
list($color, $symbol, $fear) = $info;

echo "$color is $symbol of $fear”;