Try this :

<?php

    $foo = array('a','b','c');

      unset($foo[1]);

      print_r($foo);    // [0] => a [2] => c

    $bar = array('a','b','c');

      $piece = array_splice ($bar, 1 ,1);

      print_r($piece);  // [0] => b 

      print_r($bar);    // [0] => a [1] => c 

?>

    http://www.php.net/manual/en/function.array-slice.php

    http://www.php.net/manual/en/function.unset.php

Regards,

Philip

On Thu, 15 Feb 2001, Nathan Cassano wrote:

> I have an array of search results which I am searching through and
> unset()ing unwanted search results. My question is once I have unset a
> result there is then a break in the numeric index and how do I stop this
> from happening or reindex the results. Like this..
> 
> $results = array(0 => array(more elements...), 1 => array(bla bla...) , 2
> =>array(....));
> 
> /* unset results index 1 */
> unset($results[1]);
> 
> /*
> 
> Now the $results index is like this..
> 
> array(0 => array(more elements...), 2 =>array(....));
> 
> */
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to