|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-08-25 19:28 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Feb 04 16:00:01 2026 UTC |
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]); } }