Javatpoint Logo
Javatpoint Logo

PHP list() function

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

Parameter Description Is compulsory
Variable1 The 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





Help Others, Please Share

facebook twitter pinterest