|
|
PHP Array list() Function
|
Tutorials » Php »
|
Topic |
What is list() Function?
|
|
Explanation |
|
The "list()" function assigns variables as if they were in an array.
Syntax:
list(var1,var2...)
In the above syntax "var1" is the first variable to be assigned and can have any number of variables.
Example
<?php
$myarray=array("Grapes","Apple","Cherry");
list($a,$b,$c)= $myarray;
echo "I have several fruits $a, $b, $c";
?>
Result:
I have several fruits Grapes, Apple, Cherry
In the above example the variables "$a,$b,$c" is assigned the values of the array "$myarray".
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|