what is list in php?

Last updated 5 years ago | 1326 views 75     5

Tags:- PHP

List 

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.

 
<?php

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

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

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

?>