php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #25237 Two, associative array functions
Submitted: 2003-08-25 11:56 UTC Modified: 2003-08-25 19:28 UTC
From: gavin at itmerge dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.3 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-08-25 11:56 UTC] 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]);
  }
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-25 19:28 UTC] sniper@php.net
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.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 18:01:31 2024 UTC