PHP Programing language

adplus-dvertising
array_list() Function in PHP
Previous Home Next
adplus-dvertising

array_list()

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

Syntax:
list(var1,var2...)

In above syntax, "var1" is used to assign a value to, "var2,..." is useto assign values to more variables.

Example:

<?php
$my_vehicle = array("Car","Scooter","Motorcycle");
list($a, $b, $c) = $my_vehicle;
echo "I have many vehicles; a $a, a $b and a $c.";
?>

Output:

I have many vehicles; a Car, a Scooter and a Motorcycle.

Previous Home Next