PHP list function Returns a List Variables from one array

October 19, 2011 | By Regaz | Filed in: Uncategorized.

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