note 77179 deleted from function.array-slice by nlopess

From: Date: Sat, 01 Sep 2007 11:58:02 +0000
Subject: note 77179 deleted from function.array-slice by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-129993@lists.php.net to get a copy of this message
Note Submitter: pfernan1 at xtec dot cat ---- Hi, is my first note and I have problems with English, excuse me plis. This is a function to remove an element of an associative array doing with de key, not with the value. function ies_esborra_element_matriu($indice, &$matriu){ $matriu_keys = array_keys($matriu); $matriu_temporal = $matriu; while (is_numeric($i=array_search($indice,$matriu_keys))){ $matriu_part1 = array_slice($matriu_temporal, 0, $i ); $matriu_part2 = array_slice($matriu_temporal, $i+1, count($matriu_temporal)-1 ); $matriu_temporal = array_merge($matriu_part1, $matriu_part2); $matriu_keys=array_keys($matriu_temporal); } return $matriu_temporal; }

« previous php.notes (#129993) next »