note 77179 added to function.array-slice
| From: | pfernan1 at xtec dot cat | Date: | Sat, 18 Aug 2007 18:47:16 +0000 |
| Subject: | note 77179 added to function.array-slice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129577@lists.php.net to get a copy of this message | ||
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;
}
----
Server IP: 194.153.94.10
Probable Submitter: 84.77.107.76
----
Manual Page -- http://www.php.net/manual/en/function.array-slice.php
Edit -- https://master.php.net/note/edit/77179
Del: integrated -- https://master.php.net/note/delete/77179/integrated
Del: useless -- https://master.php.net/note/delete/77179/useless
Del: bad code -- https://master.php.net/note/delete/77179/bad+code
Del: spam -- https://master.php.net/note/delete/77179/spam
Del: non-english -- https://master.php.net/note/delete/77179/non-english
Del: in docs -- https://master.php.net/note/delete/77179/in+docs
Del: other reasons-- https://master.php.net/note/delete/77179
Reject -- https://master.php.net/note/reject/77179
Search -- https://master.php.net/manage/user-notes.php