Bug #17090: Getting slices of associative arrays

From: Date: Wed, 08 May 2002 10:04:35 +0000
Subject: Bug #17090: Getting slices of associative arrays
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-7212@lists.php.net to get a copy of this message
From: chs@baltic-online.de Operating system: Solaris 5.8 PHP version: 4.2.0 PHP Bug Type: Feature/Change Request Bug description: Getting slices of associative arrays Hello, unless I have overlooked something, there seems to be no easy way to get a slice of an associative array based on certain keys. I would like to be able to do something like the following: $array["a"] = 1; $array["b"] = 2; $array["c"] = 3; $slice = hash_slice($array, array("a", "c")); which would result in $slice becoming an array containing the values 1 and 3, associated with the keys a and c, respectively. If something like this already exists, I'd be happy if you could let me know; otherwise, I'd like to suggest this as a feature for a future version of PHP. Thank you! -- Edit bug report at http://bugs.php.net/?id=17090&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17090&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17090&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17090&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17090&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17090&r=support Expected behavior: http://bugs.php.net/fix.php?id=17090&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17090&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17090&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17090&r=globals

« previous php.bugs (#7212) next »