PHP list() Function

6 Jan 2025 | 1 min read

The PHP list( ) function is used to assign values to a list of variables in one operation. This function was introduced in PHP 4.0.

Syntax

Parameter

ParameterDescriptionIs compulsory
Variable1The first variable to assign a value to.compulsory
Variable2...More variables to assign values to.Optional

Returns

The list( ) function returns the assigned array.

Example 1

Output:

 I have many cars like, a audi, a ford and a toyota. 

Example 2

Output:

 Here I only use the audi and mercedes variables. 

Example 3

Output:

 I am expert in php, javascript and html. 

Example 4

Output:

 We have covered php and asp.net and so many other topics