What is the use of list() function?
The list() function is used to assign values to a list of variables in one operation. list() function basically works on numerical arrays.
Syntax of list() function:-
list(variable1,variable2,variable3.....)
<?php
//here Student_name is a variable
$Student_name = array("Joe","Kallis","Roy","Ramon");
// here call the list() and decleare variable
list($t,$x, $y, $z) = $Student_;name;
//print the all variable
echo "All student name is:- a->$t, b->$x, c->$y, d->$z.";
?>
Output will come like this:
All student name is:
a->Joe,
b->Kallis,
c->Roy,
d->Ramon
0 Comment(s)