note 29926 added to function.array-pop
| From: | Alex at rack1 dot php dot net | Date: | Fri, 28 Feb 2003 23:16:40 +0000 |
| Subject: | note 29926 added to function.array-pop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44680@lists.php.net to get a copy of this message | ||
alex.chacon@terra.com
Hi
Here there is a function that delete a elemente from a array and re calculate indexes
function eliminarElementoArreglo ($array, $indice)
{
if (array_key_exists($indice, $array))
{
$temp = $array[0];
$array[0] = $array[$indice];
$array[$indice] = $temp;
array_shift($array);
//reacomodamos índices
for ($i = 0 ; $i < $indice ; $i++)
{
$dummy = $array[$i];
$array[$i] = $temp;
$temp = $dummy;
}
}
return $array;
}
--
http://www.php.net/manual/en/function.array-pop.php
http://master.php.net/manage/user-notes.php?action=edit+29926
http://master.php.net/manage/user-notes.php?action=delete+29926
http://master.php.net/manage/user-notes.php?action=reject+29926