note 36313 deleted from function.array-map by aidan

From: Date: Tue, 06 Jul 2004 08:29:02 +0000
Subject: note 36313 deleted from function.array-map by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72717@lists.php.net to get a copy of this message
Note Submitter: brendan424242 _at_ yahoo _dot_ com ---- I've found the compostional feature, that's supposed to do array_map(NULL, $a1, $a2) ==> [[$a1[0], $a2[0]], [$a1[1], $a[1]].... seems buggy in certain situations on 4.2.2. Instead, I'm using this, which always works for me: // Argh, array_map seems to be bug-ful with the NULL callback.. // Instead make my own, a la python zip(): function zip($a, $b) { assert( count($a) == count($b) ); $newarr = Array(); for($i=0; $i<count($a); $i++) { $newarr[] = array($a[$i], $b[$i]); } return $newarr; }

« previous php.notes (#72717) next »