#25237 [Opn->WFx]: Two, associative array functions

From: Date: Tue, 26 Aug 2003 00:28:08 +0000
Subject: #25237 [Opn->WFx]: Two, associative array functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-46616@lists.php.net to get a copy of this message
ID: 25237 Updated by: sniper@php.net Reported By: gavin at itmerge dot com -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: Linux PHP Version: 4.3.3 New Comment: As you proved yourself, it can be done easily with PHP code. Post those funcs as manual notes instead, maybe someone finds them useful too. Previous Comments: ------------------------------------------------------------------------ [2003-08-25 11:56:33] gavin at itmerge dot com Description: ------------ I wasn't able to use array_slice or array_splice on my associative arrays so I wrote two functions that others may find useful. Reproduce code: --------------- /* Remove a list of Associative keys from an array */ function array_unset(&$array,$list) { foreach($list as $val) { unset($array[$val]); } } /* Transport a list of Associate keys from one array to another */ function array_trans(&$arrayfrom,&$arrayto,$list) { foreach ($list as $val) { $arrayto[$val]=$arrayfrom[$val]; unset($arrayfrom[$val]); } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25237&edit=1

« previous php.bugs (#46616) next »