Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/10/2011, 17:47
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: unset heredando de ArrayIterator

Ese es un pequeño bug conocido ya, aquí encuentras otra alternativa. Un amigo lo reportó pero no se para cuando lo arreglen :D supongo que php 5.4.0

Código PHP:
Ver original
  1. To avoid this bug you can call offsetUnset in the for loop
  2.  
  3. <?php
  4. /*** ... ***/
  5. for ( $b->rewind(); $b->valid(); $b->offsetUnset( $b->key() ) )
  6. {
  7. /*** ... ***/
  8. ?>
  9.  
  10. Or unset it directly in the ArrayObject
  11. <?php
  12. /*** ... ***/
  13.     $a->offsetUnset( $b->key() );
  14. /*** ... ***/
  15. ?>
  16.  
  17. which will produce correct results

http://www.php.net/manual/es/arrayit...set.php#104789

Saludos.
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP