PHP List Function Returns A List Variables From One Array

October 19, 2011 | By Regaz.

The PHP list function is utilized to Associate and Return in one Step a List of Variables from one Array.
$Menu = Array(‘Caprese’, ‘Lasagne’, ‘Grilled Steak’, ‘Creme Caramel’);
list($appetizer, $firstPlate, $secondPlate, $desert) = $Dishes;
So now the Variables Content will be directly Set to:
$appetizer -> ‘Caprese’
$firstPlate -> ‘Lasagne’
$secondPlate -> ‘Grilled Steak’
$desert -> ‘Creme Caramel’

QuickChic Theme • Powered by WordPress