Google News
logo
PHP - Interview Questions
What is list in PHP?
The list is similar to an array but it is not a function, instead, it is a language construct. This is used for the assignment of a list of variables in one operation. If you are using PHP 5 version, then the list values start from a rightmost parameter, and if you are using PHP 7 version, then your list starts with a left-most parameter. Code is like:

<?php
  $info = array('red', 'sign', 'danger');
  // Listing all the variables
  list($color, $symbol, $fear) = $info;
  echo "$color is $symbol of $fear”
?>​
Advertisement