Re: [PHP] array_splice()

2002-08-21 Thread Bas Jobsen




$test=array('a'=>1,'b'=>2,'c'=>3);
foreach ($test as $key=>$value)
{
 if ($value==2) unset($test[$key]);
}

or

$test=array('a'=>1,'b'=>2,'c'=>3);
$i=0;
foreach ($test as $key=>$value)
{
 if ($value==2) array_splice($test,$i,1);
$i++;
}


Op woensdag 21 augustus 2002 12:17, schreef u:
> Hi evey1,
> sorry if I' ve already posted this :
> in order to remove a whole array of values from a multidimensional array
> I tried the following:
>
> foreach($bkmks as $val) {
>
> if($val[8]==$cod){
>array_splice($bkmks,$val,1);
>}
>   }It works fine for all the
> arrays but the first ($bkmks[0])
>  When I try to remove that array this is what I get :
> Fatal error: Maximum execution time of 30 seconds exceeded in .
>  after that if I read $bkmks all the arrays have been removed but
> $bkmks[0]
> (the array I wanted to  remove)
> Why ?
> Is there a better way to do it ?
>
> thanks again

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] array_splice()

2002-08-21 Thread Riccardo Sepe

Hi evey1,
sorry if I' ve already posted this :
in order to remove a whole array of values from a multidimensional array 
I tried the following:

foreach($bkmks as $val) { 
  
if($val[8]==$cod){
   array_splice($bkmks,$val,1);
   }
  }It works fine for all the 
arrays but the first ($bkmks[0])
 When I try to remove that array this is what I get :
Fatal error: Maximum execution time of 30 seconds exceeded in .
 after that if I read $bkmks all the arrays have been removed but 
$bkmks[0]
(the array I wanted to  remove)
Why ?
Is there a better way to do it ?

thanks again


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] array_splice()

2002-08-20 Thread Riccardo Sepe

Hi evey1,
in order to remove a whole array of values from a multidimensional array 
I tried the following:

foreach($bkmks as $val) { 
if($val[8]==$cod){
array_splice($bkmks,$val,1);
}
   }
It works fine for all the arrays but the first ($bkmks[0]) When I 
try to remove that array this is what I get :
Fatal error: Maximum execution time of 30 seconds exceeded in .
 after that if I read $bkmks all the arrays have been removed but 
$bkmks[0](the array I wanted to  remove)
Why ?
Is there a better way to do it ?

thanks again


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php