note 23436 added to function.array

From: Date: Thu, 18 Jul 2002 14:35:09 +0000
Subject: note 23436 added to function.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-33251@lists.php.net to get a copy of this message
here's a nice short/lazy way to create an array: function ar($combos) { $choices = explode("|", $combos); foreach ($choices as $choice) { list($short, $long) = explode(":", $choice); $john[$short] = $long; } return $john; } $genders = ar("M:Male|F:Female"); // $genders['M'] = 'Male'; // $genders['F'] = 'Female'; -- http://www.php.net/manual/en/function.array.php http://master.php.net/manage/user-notes.php?action=edit+23436 http://master.php.net/manage/user-notes.php?action=delete+23436 http://master.php.net/manage/user-notes.php?action=reject+23436

« previous php.notes (#33251) next »