PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/standard/tests/array/array_pop.php

http://github.com/facebook/hiphop-php
PHP | 41 lines | 32 code | 7 blank | 2 comment | 1 complexity | e6b2c60fdd5d0f0f65ac2076f0fc654f MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. array_pop($GLOBALS);
  3. $empty_array = array();
  4. $number = 5;
  5. $str = "abc";
  6. /* Various combinations of arrays to be used for the test */
  7. $mixed_array = array(
  8. array(),
  9. array( 1,2,3,4,5,6,7,8,9 ),
  10. array( "One", "_Two", "Three", "Four", "Five" ),
  11. array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
  12. array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
  13. array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
  14. array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
  15. array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
  16. "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
  17. array( 12, "name", 'age', '45' ),
  18. array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
  19. array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
  20. 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
  21. );
  22. /* Loop to test normal functionality with different arrays inputs */
  23. echo "\n*** Normal testing with various array inputs ***\n";
  24. $counter = 1;
  25. foreach( $mixed_array as $sub_array )
  26. {
  27. echo "\n-- Input Array for Iteration $counter is --\n";
  28. print_r( $sub_array );
  29. echo "\nOutput after Pop is :\n";
  30. var_dump( array_pop($sub_array) );
  31. $counter++;
  32. }
  33. echo"\nDone";
  34. ?>