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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gavin at itmerge dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 19 17:00:02 2025 UTC