PHP list function Returns a List Variables from one array

October 19th, 2011 by Regaz

The PHP list function is utilized to Associate and Return in one Step a List of Variables from one Array.

Example:

$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’

(Visited 1 times, 1 visits today)

Tags: