array_push_empty.phpt 481 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Test array_push() function : push empty set to the array
  3. --FILE--
  4. <?php
  5. /* Prototype : int array_push(array $stack[, mixed $...])
  6. * Description: Pushes elements onto the end of the array
  7. * Source code: ext/standard/array.c
  8. */
  9. $array = [1,2,3];
  10. $values = [];
  11. var_dump( array_push($array) );
  12. var_dump( array_push($array, ...$values) );
  13. var_dump( $array );
  14. echo "Done";
  15. ?>
  16. --EXPECTF--
  17. int(3)
  18. int(3)
  19. array(3) {
  20. [0]=>
  21. int(1)
  22. [1]=>
  23. int(2)
  24. [2]=>
  25. int(3)
  26. }
  27. Done