$array = [1, 2, 3];
list($a, $b, $c) = $array;
echo $a; // 输出1
echo $b; // 输出2
echo $c; // 输出3
// 交换两个变量的值
$a = 1;
$b = 2;
list($a, $b) = [$b, $a];
echo $a; // 输出2
echo $b; // 输出1
$nestedArray = [1, [2, 3], 4];
list($a, list($b, $c), $d) = $nestedArray;
echo $a; // 输出1
echo $b; // 输出2
echo $c; // 输出3
echo $d; // 输出4
$assocArray = ['name' => 'Alice', 'age' => 25];
list('name' => $name, 'age' => $age) = $assocArray;
echo $name; // 输出Alice
echo $age; // 输出25
$array = [1, 2, 3, 4];
list(, $b, , $d) = $array;
echo $b; // 输出2
echo $d; // 输出4
list($a, $b, $c) = range(1, 3);
echo $a; // 输出1
echo $b; // 输出2
echo $c; // 输出3