This article describes the list method usage in PHP. Share to everyone for your reference, specific as follows:
<?php
function small_numbers ()
{return
array (0, 1, 2);
}
List ($zero, $one, $two) = Small_numbers ();
Var_dump ($zero);
Var_dump ($one);
Var_dump ($two);
? >
Output:
Change
<?php
function small_numbers ()
{return
array (0, 1);
}
List ($zero, $one, $two) = Small_numbers ();
Var_dump ($zero);
Var_dump ($one);
Var_dump ($two);
? >
Output:
notice:undefined Offset:2 in D:\xampp\htdocs\t\test.php on line 6
int (0)
int (1)
NULL
Change it again.
<?php
function small_numbers ()
{return
array (0, 1, 2, 3);
}
List ($zero, $one, $two) = Small_numbers ();
Var_dump ($zero);
Var_dump ($one);
Var_dump ($two);
? >
Output:
Change again, extrapolate learning method
<?php
function small_numbers ()
{return
array (0, 1, Array (' 2 '));
}
List ($zero, $one, $two) = Small_numbers ();
Var_dump ($zero);
Var_dump ($one);
Var_dump ($two);
? >
Output:
Int (0)
int (1)
Array (1) {
[0]=>
string (1) "2"
}
More interested in PHP related content readers can view the site topics: "PHP array" Operation tips Daquan, "PHP Sorting algorithm Summary", "PHP string (String) Usage summary", "PHP for XML file Operating skills summary", " PHP error and exception handling method summary, "PHP operation and operator Usage Summary", "PHP basic Grammar Introductory Course", "PHP object-oriented Programming Introduction Course", "Php+mysql Database Operation Introduction Course" and "PHP common database Operation skill Summary"
I hope this article will help you with the PHP program design.