PHP list() Function
PHP list() Function
The list() function in PHP sorts an array by key while maintaining the keys.
Syntax
list ( mixed $var1 [, mixed $... ] )
Parameter
var1(required)- This parameter accepts variables separated by spaces.
…(optional)- This parameter accepts a list of variables separated by spaces.
Return
This function returns the assigned array.
Example 1
Output
The PHP is easy to learn. It was created by Rasmus Lerdorf.
Example 2
Output
The PHP was created by Rasmus Lerdorf.
Example 3
Output
The ‘’ is an easy language.
Example 4
Output
I am learning PHP!