Using list() to Assign Variables as if They Were an Array in PHP


Easily assign list of variables from an array.

Source Code

$info = ['coffee', 'brown', 'caffeine'];
list($drink, $color, $power) = $info;
echo "$drink is $color and $power makes it special.n";
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments