PHP list Keyword

PHP namespace Keyword
PHP isset() Function

In this article, you will learn how to assign array values to the variables in PHP.

The list keyword in PHP assigns elements of an array to a list of variables. If there are not enough elements in the array it will output a notice and assign null to the remaining variables.

examples of the LIST function

Example 1. In this example, we assign elements of an array to variables.

<?php
list($a, $b, $c) = [1, 2, 3];
echo "$a is " . $a . "<br>";
echo "$b is " . $b . "<br>";
echo "$c is " . $c . "<br>";
?>
PHP namespace Keyword
PHP isset() Function
en English
X
Scroll to Top