SplFixedArray_offsetUnset_string.phpt 626 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Check removing an item from an array when the offset is not an integer.
  3. --CREDITS--
  4. PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
  5. --FILE--
  6. <?php
  7. // Create a fixed array
  8. $fixedArray = new SplFixedArray(5);
  9. // Fill it up
  10. for ($i=0; $i < 5; $i++) {
  11. $fixedArray[$i] = "PHPNW Testfest";
  12. }
  13. // remove an item
  14. $fixedArray->offsetUnset("4");
  15. var_dump($fixedArray);
  16. ?>
  17. --EXPECT--
  18. object(SplFixedArray)#1 (5) {
  19. [0]=>
  20. string(14) "PHPNW Testfest"
  21. [1]=>
  22. string(14) "PHPNW Testfest"
  23. [2]=>
  24. string(14) "PHPNW Testfest"
  25. [3]=>
  26. string(14) "PHPNW Testfest"
  27. [4]=>
  28. NULL
  29. }