summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:48 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:48 -0400
commiteddbbea4325e602ddc87c545531609132d4f0e3b (patch)
treef0994206a7e0a6251be7cc6729ba480f0c8729c2 /ext/standard/tests/array
parent2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (diff)
downloadphp-eddbbea4325e602ddc87c545531609132d4f0e3b.tar.gz
Imported Upstream version 5.2.3upstream/5.2.3
Diffstat (limited to 'ext/standard/tests/array')
-rw-r--r--ext/standard/tests/array/005.phpt309
-rw-r--r--ext/standard/tests/array/009.phpt714
-rw-r--r--ext/standard/tests/array/array_change_key_case.phpt202
-rwxr-xr-xext/standard/tests/array/array_fill_keys.phpt2
-rw-r--r--ext/standard/tests/array/array_key_exists.phpt280
-rw-r--r--ext/standard/tests/array/array_keys.phpt466
-rw-r--r--ext/standard/tests/array/array_keys_64bit.phpt472
-rw-r--r--ext/standard/tests/array/array_map.phpt423
-rw-r--r--ext/standard/tests/array/array_pop.phpt286
-rw-r--r--ext/standard/tests/array/array_search.phpt868
-rw-r--r--ext/standard/tests/array/array_values.phptbin713 -> 5251 bytes
-rw-r--r--ext/standard/tests/array/array_values_64bit.phptbin0 -> 5245 bytes
-rw-r--r--ext/standard/tests/array/bug28974.phpt2
-rwxr-xr-xext/standard/tests/array/bug29253.phpt2
-rwxr-xr-xext/standard/tests/array/bug33940.phpt2
-rwxr-xr-xext/standard/tests/array/bug34982.phpt2
-rw-r--r--ext/standard/tests/array/each.phptbin0 -> 9548 bytes
-rw-r--r--ext/standard/tests/array/end.phpt238
-rw-r--r--ext/standard/tests/array/end_64bit.phpt238
-rw-r--r--ext/standard/tests/array/extract.phpt276
-rw-r--r--ext/standard/tests/array/max.phpt2
-rw-r--r--ext/standard/tests/array/min.phpt2
-rw-r--r--ext/standard/tests/array/range.phpt1920
-rw-r--r--ext/standard/tests/array/range_64bit.phpt1207
24 files changed, 6793 insertions, 1120 deletions
diff --git a/ext/standard/tests/array/005.phpt b/ext/standard/tests/array/005.phpt
index cdf731827..626c96166 100644
--- a/ext/standard/tests/array/005.phpt
+++ b/ext/standard/tests/array/005.phpt
@@ -1,46 +1,291 @@
--TEST--
-Test array_shift behaviour
+Test array_shift() function
--FILE--
<?php
+/* Prototype: mixed array_shift( array &array );
+ * Description: Shifts the first value of the array off and returns it.
+ */
array_shift($GLOBALS);
-$a = array("foo", "bar", "fubar");
-$b = array("3" => "foo", "4" => "bar", "5" => "fubar");
-$c = array("a" => "foo", "b" => "bar", "c" => "fubar");
+$empty_array = array();
+$number = 5;
+$str = "abc";
-/* simple array */
-echo array_shift($a), "\n";
-var_dump($a);
-/* numerical assoc indices */
-echo array_shift($b), "\n";
-var_dump($b);
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
-/* assoc indices */
-echo array_shift($c), "\n";
-var_dump($c);
+/* Testing Error Conditions */
+echo "\n*** Testing Error Conditions ***\n";
+/* Zero argument */
+var_dump( array_shift() );
+
+/* Scalar argument */
+var_dump( array_shift($number) );
+
+/* String argument */
+var_dump( array_shift($str) );
+
+/* Invalid Number of arguments */
+var_dump( array_shift($mixed_array[1],$mixed_array[2]) );
+
+/* Empty Array as argument */
+var_dump( array_shift($empty_array) );
+
+/* Loop to test normal functionality with different arrays inputs */
+echo "\n*** Testing with various array inputs ***\n";
+
+$counter = 1;
+foreach( $mixed_array as $sub_array ) {
+ echo "\n-- Input Array for Iteration $counter is -- \n";
+ print_r( $sub_array );
+ echo "\nOutput after shift is :\n";
+ var_dump( array_shift($sub_array) );
+ $counter++;
+}
+
+/*Checking for internal array pointer beint reset when shift is called */
+
+echo"\n*** Checking for internal array pointer being reset when shift is called ***\n";
+
+echo "\nCurrent Element is : ";
+var_dump( current($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nshifted Element is : ";
+var_dump( array_shift($mixed_array[1]) );
+
+echo "\nCurrent Element after shift operation is: ";
+var_dump( current($mixed_array[1]) );
+
+echo"Done";
?>
---EXPECT--
-foo
-array(2) {
- [0]=>
- string(3) "bar"
- [1]=>
- string(5) "fubar"
-}
-foo
-array(2) {
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for array_shift() in %s line %d
+NULL
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_shift(): The argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_shift() in %s on line %d
+NULL
+NULL
+
+*** Testing with various array inputs ***
+
+-- Input Array for Iteration 1 is --
+Array
+(
+)
+
+Output after shift is :
+NULL
+
+-- Input Array for Iteration 2 is --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+)
+
+Output after shift is :
+int(1)
+
+-- Input Array for Iteration 3 is --
+Array
+(
+ [0] => One
+ [1] => _Two
+ [2] => Three
+ [3] => Four
+ [4] => Five
+)
+
+Output after shift is :
+string(3) "One"
+
+-- Input Array for Iteration 4 is --
+Array
+(
+ [0] => 6
+ [1] => six
+ [2] => 7
+ [3] => seven
+ [4] => 8
+ [5] => eight
+ [6] => 9
+ [7] => nine
+)
+
+Output after shift is :
+int(6)
+
+-- Input Array for Iteration 5 is --
+Array
+(
+ [a] => aaa
+ [A] => AAA
+ [c] => ccc
+ [d] => ddd
+ [e] => eee
+)
+
+Output after shift is :
+string(3) "aaa"
+
+-- Input Array for Iteration 6 is --
+Array
+(
+ [1] => one
+ [2] => two
+ [3] => three
+ [4] => four
+ [5] => five
+)
+
+Output after shift is :
+string(3) "one"
+
+-- Input Array for Iteration 7 is --
+Array
+(
+ [1] => one
+ [2] => two
+ [3] => 7
+ [4] => four
+ [5] => five
+)
+
+Output after shift is :
+string(3) "one"
+
+-- Input Array for Iteration 8 is --
+Array
+(
+ [f] => fff
+ [1] => one
+ [4] => 6
+ [] => 3
+ [2] => float
+ [F] => FFF
+ [blank] =>
+ [3] => 3.7
+ [5] => Five
+ [6] => 8.6
+ [4name] => jonny
+ [a] =>
+)
+
+Output after shift is :
+string(3) "fff"
+
+-- Input Array for Iteration 9 is --
+Array
+(
+ [0] => 12
+ [1] => name
+ [2] => age
+ [3] => 45
+)
+
+Output after shift is :
+int(12)
+
+-- Input Array for Iteration 10 is --
+Array
+(
+ [0] => Array
+ (
+ [0] => oNe
+ [1] => tWo
+ [2] => 4
+ )
+
+ [1] => Array
+ (
+ [0] => 10
+ [1] => 20
+ [2] => 30
+ [3] => 40
+ [4] => 50
+ )
+
+ [2] => Array
+ (
+ )
+
+)
+
+Output after shift is :
+array(3) {
[0]=>
- string(3) "bar"
+ string(3) "oNe"
[1]=>
- string(5) "fubar"
-}
-foo
-array(2) {
- ["b"]=>
- string(3) "bar"
- ["c"]=>
- string(5) "fubar"
+ string(3) "tWo"
+ [2]=>
+ int(4)
}
+
+-- Input Array for Iteration 11 is --
+Array
+(
+ [one] => 2
+ [three] => 3
+ [0] => 3
+ [1] => 4
+ [3] => 33
+ [4] => 44
+ [5] => 57
+ [6] => 6
+ [5.4] => 554
+ [5.7] => 557
+)
+
+Output after shift is :
+int(2)
+
+*** Checking for internal array pointer being reset when shift is called ***
+
+Current Element is : int(1)
+
+Next Element is : int(2)
+
+Next Element is : int(3)
+
+shifted Element is : int(1)
+
+Current Element after shift operation is: int(2)
+Done
diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt
new file mode 100644
index 000000000..399a1d5aa
--- /dev/null
+++ b/ext/standard/tests/array/009.phpt
@@ -0,0 +1,714 @@
+--TEST--
+Test key(), current(), next() & reset() functions
+--FILE--
+<?php
+/* Prototype & Usage:
+ mixed key ( array &$array ) -> returns the index element of the current array position
+ mixed current ( array &$array ) -> returns the current element in the array
+ mixed next ( array &$array ) -> similar to current() but advances the internal pointer to next element
+ mixed reset ( array &$array ) -> Reset the internal pointer to first element
+*/
+
+$basic_arrays = array (
+ array(0), // array with element as 0
+ array(1), // array with single element
+ array(1,2, 3, -1, -2, -3), // array of integers
+ array(1.1, 2.2, 3.3, -1.1, -2.2, -3.3), // array of floats
+ array('a', 'b', 'c', "ab", "ac", "ad"), // string array
+ array("a" => "apple", "b" => "book", "c" => "cook"), // associative array
+ array('d' => 'drink', 'p' => 'port', 's' => 'set'), // another associative array
+ array(1 => 'One', 2 => 'two', 3 => "three") // associative array with key as integers
+);
+
+$varient_arrays = array (
+ array(), // empty array
+ array(""), // array with null string
+ array(NULL),// array with NULL
+ array(null),// array with null
+ array(NULL, true, null, "", 1), // mixed array
+ array(-1.5 => "test", -2 => "rest", 2.5 => "two",
+ "" => "string", 0 => "zero", "" => "" ) // mixed array
+);
+
+echo "*** Testing basic operations ***\n";
+$loop_count = 1;
+foreach ($basic_arrays as $sub_array ) {
+ echo "-- Iteration $loop_count --\n";
+ $loop_count++;
+ $c = count ($sub_array);
+ $c++; // increment by one to create the situation of accessing beyond array size
+ while ( $c ) {
+ var_dump( current($sub_array)); // current element
+ var_dump( key($sub_array) ); // key of the current element
+ var_dump( next($sub_array) ); // move to next element
+ $c --;
+ }
+ var_dump( reset($sub_array) ); // reset the internal pointer to first element
+ var_dump( key($sub_array) ); // access the array after reset
+ var_dump( $sub_array ); // dump the array to see that its intact
+
+ echo "\n";
+}
+
+echo "\n*** Testing possible variations ***\n";
+$loop_count = 1;
+foreach ($varient_arrays as $sub_array ) {
+ echo "-- Iteration $loop_count --\n";
+ $loop_count++;
+ $c = count ($sub_array);
+ $c++; // increment by one to create the situation of accessing beyond array size
+ while ( $c ) {
+ var_dump( current($sub_array)); // current element
+ var_dump( key($sub_array) ); // key of the current element
+ var_dump( next($sub_array) ); // move to next element
+ $c --;
+ }
+ var_dump( reset($sub_array) ); // reset the internal pointer to first element
+ var_dump( key($sub_array) ); // access the array after reset
+ var_dump( $sub_array ); // dump the array to see that its intact
+ echo "\n";
+}
+
+/*test these functions on array which is already unset */
+echo "\n-- Testing variation: when array is unset --\n";
+$unset_array = array (1);
+unset($unset_array);
+
+var_dump( current($unset_array) );
+var_dump( key($unset_array) );
+var_dump( next($unset_array) );
+var_dump( reset($unset_array) );
+
+
+echo "\n*** Testing error conditions ***\n";
+//Zero argument, expected 1 argument
+var_dump( key() );
+var_dump( current() );
+var_dump( reset() );
+var_dump( next() );
+
+// args more than expected, expected 1 argument
+$temp_array = array(1);
+var_dump( key($temp_array, $temp_array) );
+var_dump( current($temp_array, $temp_array) );
+var_dump( reset($temp_array, $temp_array) );
+var_dump( next($temp_array, $temp_array) );
+
+// invalid args type, valid arguement: array
+$int_var = 1;
+$float_var = 1.5;
+$string = "string";
+var_dump( key($int_var) );
+var_dump( key($float_var) );
+var_dump( key($string) );
+
+var_dump( current($int_var) );
+var_dump( current($float_var) );
+var_dump( current($string) );
+
+var_dump( next($int_var) );
+var_dump( next($float_var) );
+var_dump( next($string) );
+
+var_dump( reset($int_var) );
+var_dump( reset($float_var) );
+var_dump( reset($string) );
+
+echo "\n*** Testing operation on Objects ***\n";
+// class having members of different scope
+class test_class
+{
+ private $private_var = "private_var";
+ public $public_var = "public_var";
+ protected $protected_var = "protected_var";
+ private $var1 = 10;
+ public $var2 = 30;
+ protected $var3 = 40;
+ var $integer = 3092;
+
+ private function private_fun() {
+ echo "private_fun() called\n";
+ }
+
+ protected function protected_fun() {
+ echo "protected_fun() called\n";
+ }
+
+ public function public_fun() {
+ echo "public_fun() called\n";
+ }
+}
+// class with no member variables
+class zero_member_var_class
+{
+ public function fun() {
+ echo "fun() called\n";
+ }
+}
+// class with no members
+class zero_member_class
+{
+ // no members
+}
+
+//create object of all classes defined above
+$test_class_obj = new test_class();
+$zero_member_var_class_obj = new zero_member_var_class();
+$zero_member_class_obj = new zero_member_class();
+
+$object_array = array (
+ $test_class_obj,
+ $zero_member_var_class_obj,
+ $zero_member_class_obj
+);
+
+/* loop to use function key(), current(), next() and reset()
+ on different class objects */
+$loop_count = 1;
+foreach( $object_array as $object ) {
+ echo "--- Outerloop Iteration $loop_count ---\n";
+
+ /* dump the object before performing operation on it */
+ echo "Object before performing operations ...\n";
+ var_dump($object) ;
+
+ /* loop to feach all the key/value pair from the object*/
+ $inner_loop_count = 1;
+ do {
+ echo "-- Innerloop iteration $inner_loop_count of Outerloop Iteration $loop_count --\n";
+ $inner_loop_count ++;
+
+ // print the key/value pair of the current value
+ echo "current => "; var_dump( current($object) ); // key & value pair
+ echo "key => "; var_dump( key($object) ); // key
+
+ $next_pair = next($object);
+ echo "next => "; var_dump($next_pair);
+
+ } while( FALSE != $next_pair );
+
+ $loop_count++;
+
+ /* reset the object */
+ echo "reset => "; var_dump( reset($object) );
+ echo "current => "; var_dump( current($object) ); // first variable in object
+
+ echo "\nObject after performing operations ...\n";
+ var_dump($object) ; // no change expected
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing basic operations ***
+-- Iteration 1 --
+int(0)
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+int(0)
+int(0)
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 2 --
+int(1)
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+int(1)
+int(0)
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- Iteration 3 --
+int(1)
+int(0)
+int(2)
+int(2)
+int(1)
+int(3)
+int(3)
+int(2)
+int(-1)
+int(-1)
+int(3)
+int(-2)
+int(-2)
+int(4)
+int(-3)
+int(-3)
+int(5)
+bool(false)
+bool(false)
+NULL
+bool(false)
+int(1)
+int(0)
+array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(-1)
+ [4]=>
+ int(-2)
+ [5]=>
+ int(-3)
+}
+
+-- Iteration 4 --
+float(1.1)
+int(0)
+float(2.2)
+float(2.2)
+int(1)
+float(3.3)
+float(3.3)
+int(2)
+float(-1.1)
+float(-1.1)
+int(3)
+float(-2.2)
+float(-2.2)
+int(4)
+float(-3.3)
+float(-3.3)
+int(5)
+bool(false)
+bool(false)
+NULL
+bool(false)
+float(1.1)
+int(0)
+array(6) {
+ [0]=>
+ float(1.1)
+ [1]=>
+ float(2.2)
+ [2]=>
+ float(3.3)
+ [3]=>
+ float(-1.1)
+ [4]=>
+ float(-2.2)
+ [5]=>
+ float(-3.3)
+}
+
+-- Iteration 5 --
+string(1) "a"
+int(0)
+string(1) "b"
+string(1) "b"
+int(1)
+string(1) "c"
+string(1) "c"
+int(2)
+string(2) "ab"
+string(2) "ab"
+int(3)
+string(2) "ac"
+string(2) "ac"
+int(4)
+string(2) "ad"
+string(2) "ad"
+int(5)
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(1) "a"
+int(0)
+array(6) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(2) "ab"
+ [4]=>
+ string(2) "ac"
+ [5]=>
+ string(2) "ad"
+}
+
+-- Iteration 6 --
+string(5) "apple"
+string(1) "a"
+string(4) "book"
+string(4) "book"
+string(1) "b"
+string(4) "cook"
+string(4) "cook"
+string(1) "c"
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(5) "apple"
+string(1) "a"
+array(3) {
+ ["a"]=>
+ string(5) "apple"
+ ["b"]=>
+ string(4) "book"
+ ["c"]=>
+ string(4) "cook"
+}
+
+-- Iteration 7 --
+string(5) "drink"
+string(1) "d"
+string(4) "port"
+string(4) "port"
+string(1) "p"
+string(3) "set"
+string(3) "set"
+string(1) "s"
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(5) "drink"
+string(1) "d"
+array(3) {
+ ["d"]=>
+ string(5) "drink"
+ ["p"]=>
+ string(4) "port"
+ ["s"]=>
+ string(3) "set"
+}
+
+-- Iteration 8 --
+string(3) "One"
+int(1)
+string(3) "two"
+string(3) "two"
+int(2)
+string(5) "three"
+string(5) "three"
+int(3)
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(3) "One"
+int(1)
+array(3) {
+ [1]=>
+ string(3) "One"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ string(5) "three"
+}
+
+
+*** Testing possible variations ***
+-- Iteration 1 --
+bool(false)
+NULL
+bool(false)
+bool(false)
+NULL
+array(0) {
+}
+
+-- Iteration 2 --
+string(0) ""
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(0) ""
+int(0)
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 3 --
+NULL
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+NULL
+int(0)
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 4 --
+NULL
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+NULL
+int(0)
+array(1) {
+ [0]=>
+ NULL
+}
+
+-- Iteration 5 --
+NULL
+int(0)
+bool(true)
+bool(true)
+int(1)
+NULL
+NULL
+int(2)
+string(0) ""
+string(0) ""
+int(3)
+int(1)
+int(1)
+int(4)
+bool(false)
+bool(false)
+NULL
+bool(false)
+NULL
+int(0)
+array(5) {
+ [0]=>
+ NULL
+ [1]=>
+ bool(true)
+ [2]=>
+ NULL
+ [3]=>
+ string(0) ""
+ [4]=>
+ int(1)
+}
+
+-- Iteration 6 --
+string(4) "test"
+int(-1)
+string(4) "rest"
+string(4) "rest"
+int(-2)
+string(3) "two"
+string(3) "two"
+int(2)
+string(0) ""
+string(0) ""
+string(0) ""
+string(4) "zero"
+string(4) "zero"
+int(0)
+bool(false)
+bool(false)
+NULL
+bool(false)
+string(4) "test"
+int(-1)
+array(5) {
+ [-1]=>
+ string(4) "test"
+ [-2]=>
+ string(4) "rest"
+ [2]=>
+ string(3) "two"
+ [""]=>
+ string(0) ""
+ [0]=>
+ string(4) "zero"
+}
+
+
+-- Testing variation: when array is unset --
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: reset(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for key() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for current() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for reset() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for next() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for key() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for current() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for reset() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for next() in %s on line %d
+NULL
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: key(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: current(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: next(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: reset(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: reset(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: reset(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+*** Testing operation on Objects ***
+--- Outerloop Iteration 1 ---
+Object before performing operations ...
+object(test_class)#1 (7) {
+ ["private_var:private"]=>
+ string(11) "private_var"
+ ["public_var"]=>
+ string(10) "public_var"
+ ["protected_var:protected"]=>
+ string(13) "protected_var"
+ ["var1:private"]=>
+ int(10)
+ ["var2"]=>
+ int(30)
+ ["var3:protected"]=>
+ int(40)
+ ["integer"]=>
+ int(3092)
+}
+-- Innerloop iteration 1 of Outerloop Iteration 1 --
+current => string(11) "private_var"
+key => string(23) "
+next => string(10) "public_var"
+-- Innerloop iteration 2 of Outerloop Iteration 1 --
+current => string(10) "public_var"
+key => string(10) "public_var"
+next => string(13) "protected_var"
+-- Innerloop iteration 3 of Outerloop Iteration 1 --
+current => string(13) "protected_var"
+key => string(16) "
+next => int(10)
+-- Innerloop iteration 4 of Outerloop Iteration 1 --
+current => int(10)
+key => string(16) "
+next => int(30)
+-- Innerloop iteration 5 of Outerloop Iteration 1 --
+current => int(30)
+key => string(4) "var2"
+next => int(40)
+-- Innerloop iteration 6 of Outerloop Iteration 1 --
+current => int(40)
+key => string(7) "
+next => int(3092)
+-- Innerloop iteration 7 of Outerloop Iteration 1 --
+current => int(3092)
+key => string(7) "integer"
+next => bool(false)
+reset => string(11) "private_var"
+current => string(11) "private_var"
+
+Object after performing operations ...
+object(test_class)#1 (7) {
+ ["private_var:private"]=>
+ string(11) "private_var"
+ ["public_var"]=>
+ string(10) "public_var"
+ ["protected_var:protected"]=>
+ string(13) "protected_var"
+ ["var1:private"]=>
+ int(10)
+ ["var2"]=>
+ int(30)
+ ["var3:protected"]=>
+ int(40)
+ ["integer"]=>
+ int(3092)
+}
+--- Outerloop Iteration 2 ---
+Object before performing operations ...
+object(zero_member_var_class)#2 (0) {
+}
+-- Innerloop iteration 1 of Outerloop Iteration 2 --
+current => bool(false)
+key => NULL
+next => bool(false)
+reset => bool(false)
+current => bool(false)
+
+Object after performing operations ...
+object(zero_member_var_class)#2 (0) {
+}
+--- Outerloop Iteration 3 ---
+Object before performing operations ...
+object(zero_member_class)#3 (0) {
+}
+-- Innerloop iteration 1 of Outerloop Iteration 3 --
+current => bool(false)
+key => NULL
+next => bool(false)
+reset => bool(false)
+current => bool(false)
+
+Object after performing operations ...
+object(zero_member_class)#3 (0) {
+}
+Done
diff --git a/ext/standard/tests/array/array_change_key_case.phpt b/ext/standard/tests/array/array_change_key_case.phpt
index 0cd1d8203..8e785a84d 100644
--- a/ext/standard/tests/array/array_change_key_case.phpt
+++ b/ext/standard/tests/array/array_change_key_case.phpt
@@ -1,56 +1,92 @@
--TEST--
-array_change_key_case()
+Test array_change_key_case() function
--FILE--
<?php
+/* Prototype: array array_change_key_case ( array $input [, int $case] )
+ Description: Changes the keys in the input array to be all lowercase
+ or uppercase. The change depends on the last optional case parameter.
+ You can pass two constants there, CASE_UPPER and CASE_LOWER(default).
+ The function will leave number indices as is.
+*/
$arrays = array (
- array (),
- array (0),
- array (1),
- array (-1),
- array (0, 2, 3, 4, 5),
- array (1, 2, 3, 4, 5),
- array ("" => 1),
- array ("a" => 1),
- array ("Z" => 1),
- array ("one" => 1),
- array ("ONE" => 1),
- array ("OnE" => 1),
- array ("oNe" => 1),
- array ("one" => 1, "two" => 2),
- array ("ONE" => 1, "two" => 2),
- array ("OnE" => 1, "two" => 2),
- array ("oNe" => 1, "two" => 2),
- array ("one" => 1, "TWO" => 2),
- array ("ONE" => 1, "TWO" => 2),
- array ("OnE" => 1, "TWO" => 2),
- array ("oNe" => 1, "TWO" => 2),
- array ("one" => 1, "TwO" => 2),
- array ("ONE" => 1, "TwO" => 2),
- array ("OnE" => 1, "TwO" => 2),
- array ("oNe" => 1, "TwO" => 2),
- array ("one" => 1, "tWo" => 2),
- array ("ONE" => 1, "tWo" => 2),
- array ("OnE" => 1, "tWo" => 2),
- array ("oNe" => 1, "tWo" => 2),
- array ("one" => 1, 2),
- array ("ONE" => 1, 2),
- array ("OnE" => 1, 2),
- array ("oNe" => 1, 2),
- array ("ONE" => 1, "TWO" => 2, "THREE" => 3, "FOUR" => "four"),
- array ("one" => 1, "two" => 2, "three" => 3, "four" => "FOUR"),
- array ("ONE" => 1, "TWO" => 2, "three" => 3, "four" => "FOUR"),
- array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four")
+ array (),
+ array (0),
+ array (1),
+ array (-1),
+ array (0, 2, 3, 4, 5),
+ array (1, 2, 3, 4, 5),
+ array ("" => 1),
+ array ("a" => 1),
+ array ("Z" => 1),
+ array ("one" => 1),
+ array ("ONE" => 1),
+ array ("OnE" => 1),
+ array ("oNe" => 1),
+ array ("one" => 1, "two" => 2),
+ array ("ONE" => 1, "two" => 2),
+ array ("OnE" => 1, "two" => 2),
+ array ("oNe" => 1, "two" => 2),
+ array ("one" => 1, "TWO" => 2),
+ array ("ONE" => 1, "TWO" => 2),
+ array ("OnE" => 1, "TWO" => 2),
+ array ("oNe" => 1, "TWO" => 2),
+ array ("one" => 1, "TwO" => 2),
+ array ("ONE" => 1, "TwO" => 2),
+ array ("OnE" => 1, "TwO" => 2),
+ array ("oNe" => 1, "TwO" => 2),
+ array ("one" => 1, "tWo" => 2),
+ array ("ONE" => 1, "tWo" => 2),
+ array ("OnE" => 1, "tWo" => 2),
+ array ("oNe" => 1, "tWo" => 2),
+ array ("one" => 1, 2),
+ array ("ONE" => 1, 2),
+ array ("OnE" => 1, 2),
+ array ("oNe" => 1, 2),
+ array ("ONE" => 1, "TWO" => 2, "THREE" => 3, "FOUR" => "four"),
+ array ("one" => 1, "two" => 2, "three" => 3, "four" => "FOUR"),
+ array ("ONE" => 1, "TWO" => 2, "three" => 3, "four" => "FOUR"),
+ array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four")
);
+echo "*** Testing basic operations ***\n";
+$loop_counter = 1;
foreach ($arrays as $item) {
+ echo "** Iteration $loop_counter **\n"; $loop_counter++;
var_dump(array_change_key_case($item));
var_dump(array_change_key_case($item, CASE_UPPER));
var_dump(array_change_key_case($item, CASE_LOWER));
echo "\n";
}
+
+echo "\n*** Testing possible variations ***\n";
+$int_var = -19;
+$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
+
+/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
+var_dump(array_change_key_case($item, "CASE_UPPER"));
+var_dump(array_change_key_case($item, 5));
+
+/* when keys are different in terms of only case */
+/* should return one value key pair with key being in lowercase */
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) );
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5), "CASE_UPPER" ) );
+
+/* should return one value key pair with key being in uppercase */
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3), CASE_UPPER ) );
+var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 ) );
+
+echo "\n*** Testing error conditions ***\n";
+/* generate different failure conditions */
+var_dump( array_change_key_case($int_var) ); // args less than expected
+var_dump( array_change_key_case($int_var, CASE_UPPER) ); // invalid first argument
+var_dump( array_change_key_case() ); // Zero argument
+var_dump( array_change_key_case($item, $item["one"], "CASE_UPPER") ); // more than expected numbers
+
echo "end\n";
?>
---EXPECT--
+--EXPECTF--
+*** Testing basic operations ***
+** Iteration 1 **
array(0) {
}
array(0) {
@@ -58,6 +94,7 @@ array(0) {
array(0) {
}
+** Iteration 2 **
array(1) {
[0]=>
int(0)
@@ -71,6 +108,7 @@ array(1) {
int(0)
}
+** Iteration 3 **
array(1) {
[0]=>
int(1)
@@ -84,6 +122,7 @@ array(1) {
int(1)
}
+** Iteration 4 **
array(1) {
[0]=>
int(-1)
@@ -97,6 +136,7 @@ array(1) {
int(-1)
}
+** Iteration 5 **
array(5) {
[0]=>
int(0)
@@ -134,6 +174,7 @@ array(5) {
int(5)
}
+** Iteration 6 **
array(5) {
[0]=>
int(1)
@@ -171,6 +212,7 @@ array(5) {
int(5)
}
+** Iteration 7 **
array(1) {
[""]=>
int(1)
@@ -184,6 +226,7 @@ array(1) {
int(1)
}
+** Iteration 8 **
array(1) {
["a"]=>
int(1)
@@ -197,6 +240,7 @@ array(1) {
int(1)
}
+** Iteration 9 **
array(1) {
["z"]=>
int(1)
@@ -210,6 +254,7 @@ array(1) {
int(1)
}
+** Iteration 10 **
array(1) {
["one"]=>
int(1)
@@ -223,6 +268,7 @@ array(1) {
int(1)
}
+** Iteration 11 **
array(1) {
["one"]=>
int(1)
@@ -236,6 +282,7 @@ array(1) {
int(1)
}
+** Iteration 12 **
array(1) {
["one"]=>
int(1)
@@ -249,6 +296,7 @@ array(1) {
int(1)
}
+** Iteration 13 **
array(1) {
["one"]=>
int(1)
@@ -262,6 +310,7 @@ array(1) {
int(1)
}
+** Iteration 14 **
array(2) {
["one"]=>
int(1)
@@ -281,6 +330,7 @@ array(2) {
int(2)
}
+** Iteration 15 **
array(2) {
["one"]=>
int(1)
@@ -300,6 +350,7 @@ array(2) {
int(2)
}
+** Iteration 16 **
array(2) {
["one"]=>
int(1)
@@ -319,6 +370,7 @@ array(2) {
int(2)
}
+** Iteration 17 **
array(2) {
["one"]=>
int(1)
@@ -338,6 +390,7 @@ array(2) {
int(2)
}
+** Iteration 18 **
array(2) {
["one"]=>
int(1)
@@ -357,6 +410,7 @@ array(2) {
int(2)
}
+** Iteration 19 **
array(2) {
["one"]=>
int(1)
@@ -376,6 +430,7 @@ array(2) {
int(2)
}
+** Iteration 20 **
array(2) {
["one"]=>
int(1)
@@ -395,6 +450,7 @@ array(2) {
int(2)
}
+** Iteration 21 **
array(2) {
["one"]=>
int(1)
@@ -414,6 +470,7 @@ array(2) {
int(2)
}
+** Iteration 22 **
array(2) {
["one"]=>
int(1)
@@ -433,6 +490,7 @@ array(2) {
int(2)
}
+** Iteration 23 **
array(2) {
["one"]=>
int(1)
@@ -452,6 +510,7 @@ array(2) {
int(2)
}
+** Iteration 24 **
array(2) {
["one"]=>
int(1)
@@ -471,6 +530,7 @@ array(2) {
int(2)
}
+** Iteration 25 **
array(2) {
["one"]=>
int(1)
@@ -490,6 +550,7 @@ array(2) {
int(2)
}
+** Iteration 26 **
array(2) {
["one"]=>
int(1)
@@ -509,6 +570,7 @@ array(2) {
int(2)
}
+** Iteration 27 **
array(2) {
["one"]=>
int(1)
@@ -528,6 +590,7 @@ array(2) {
int(2)
}
+** Iteration 28 **
array(2) {
["one"]=>
int(1)
@@ -547,6 +610,7 @@ array(2) {
int(2)
}
+** Iteration 29 **
array(2) {
["one"]=>
int(1)
@@ -566,6 +630,7 @@ array(2) {
int(2)
}
+** Iteration 30 **
array(2) {
["one"]=>
int(1)
@@ -585,6 +650,7 @@ array(2) {
int(2)
}
+** Iteration 31 **
array(2) {
["one"]=>
int(1)
@@ -604,6 +670,7 @@ array(2) {
int(2)
}
+** Iteration 32 **
array(2) {
["one"]=>
int(1)
@@ -623,6 +690,7 @@ array(2) {
int(2)
}
+** Iteration 33 **
array(2) {
["one"]=>
int(1)
@@ -642,6 +710,7 @@ array(2) {
int(2)
}
+** Iteration 34 **
array(4) {
["one"]=>
int(1)
@@ -673,6 +742,7 @@ array(4) {
string(4) "four"
}
+** Iteration 35 **
array(4) {
["one"]=>
int(1)
@@ -704,6 +774,7 @@ array(4) {
string(4) "FOUR"
}
+** Iteration 36 **
array(4) {
["one"]=>
int(1)
@@ -735,6 +806,7 @@ array(4) {
string(4) "FOUR"
}
+** Iteration 37 **
array(4) {
["one"]=>
int(1)
@@ -766,4 +838,56 @@ array(4) {
string(4) "four"
}
+
+*** Testing possible variations ***
+array(4) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+ ["three"]=>
+ int(3)
+ ["four"]=>
+ string(4) "four"
+}
+array(4) {
+ ["ONE"]=>
+ int(1)
+ ["TWO"]=>
+ int(2)
+ ["THREE"]=>
+ int(3)
+ ["FOUR"]=>
+ string(4) "four"
+}
+array(1) {
+ ["one"]=>
+ int(4)
+}
+array(1) {
+ ["one"]=>
+ int(5)
+}
+array(1) {
+ ["ONE"]=>
+ int(3)
+}
+array(1) {
+ ["ONE"]=>
+ int(2)
+}
+
+*** Testing error conditions ***
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: array_change_key_case(): The argument should be an array in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for array_change_key_case() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_change_key_case() in %s on line %d
+NULL
end
diff --git a/ext/standard/tests/array/array_fill_keys.phpt b/ext/standard/tests/array/array_fill_keys.phpt
index 65c38234c..b4d51680e 100755
--- a/ext/standard/tests/array/array_fill_keys.phpt
+++ b/ext/standard/tests/array/array_fill_keys.phpt
@@ -1,5 +1,7 @@
--TEST--
basic array_fill_keys test
+--INI--
+precision=14
--FILE--
<?php
var_dump(array_fill_keys('test', 1));
diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt
index e7b6c0677..0d0b66301 100644
--- a/ext/standard/tests/array/array_key_exists.phpt
+++ b/ext/standard/tests/array/array_key_exists.phpt
@@ -1,24 +1,254 @@
--TEST--
-array_key_exists() tests
+Test array_key_exists() function
--FILE--
<?php
+/* Prototype:
+ * bool array_key_exists ( mixed $key, array $search );
+ * Description:
+ * Returns TRUE if the given key is set in the array.
+ * key can be any value possible for an array index.
+ * Also also works on objects.
+ */
-var_dump(array_key_exists());
-var_dump(array_key_exists(array(), array()));
-var_dump(array_key_exists("", ""));
-var_dump(array_key_exists("", array()));
-var_dump(array_key_exists(1, array()));
+echo "*** Testing basic functionalities ***\n";
+/* Arrays with regular values */
+$search_arrays = array(
+ array(1,2,3,4),
+ array('a','b','c'),
+ array('abc', 'bcd', 'dcf'),
+ array("test", "rest", "enjoy"),
+ array("Name" => "Jack", "Loc" => "Mars", "Id" => "MS123"),
+ array('Red' => 'Rose', 'I' => 'You'),
+ array(0 => 'Zero', 1 => 'One', 2 => 'Two', 3 => "Three" ),
+ array(0.1 => 'Zero', 1.1 => 'One', 2.2 => 'Two', 3.3 => "Three" )
+ );
+/* keys to search in $search_arrays. $keys[0]
+ is the key to be searched in $search_arrays[0] and so on */
+$keys = array( 1, 'a', 2, 4, "Name", "Red", 0, 3 );
-var_dump(array_key_exists(1, array(1,2,3)));
-var_dump(array_key_exists("a", array(3,2,1,"a"=>1)));
-var_dump(array_key_exists("a", array(3,2,1)));
-var_dump(array_key_exists(NULL, array(5,6,7,""=>"value", 3,2,1)));
-var_dump(array_key_exists(NULL, array(5,6,7,3,2,1)));
-var_dump(array_key_exists(false, array(5,6,7,""=>"value", 3,2,1)));
+$key_counter = 0;
+foreach ($search_arrays as $search_array) {
+ $key = $keys[ $key_counter++ ];
+ echo "-- Iteration $key_counter --\n";
+ var_dump( array_key_exists($key, $search_array) );
+}
+echo "\n*** Testing possible variations ***\n";
+// use different keys on each sub array of $search_arrays
+$key_variations = array ("", NULL, null, " ", '', "test", 1);
+$key_counter = 0;
+$key_count = count ( $key_variations );
+echo "\n** Variation loop 1 **\n";
+$out_loop_count = 0;
+foreach ($search_arrays as $search_array) {
+ $key_counter = 0;
+ $out_loop_count ++; echo "-- Iteration $out_loop_count --\n";
+ while ( $key_counter < $key_count ) {
+ $key = $key_variations[ $key_counter++ ];
+ var_dump( array_key_exists($key, $search_array) );
+ }
+}
+// arrays with variation in elements
+$search_arrays_v = array (
+ array(),
+ array(NULL),
+ array(array(), 1, 2),
+ array(1,2,3, "" => "value", NULL => "value", true => "value" ),
+ array( array(2,4,5), array ("a","b","d") )
+ );
+// search for $key_variations in each sub array of $search_arrays_v
+echo "\n** Variation loop 2 **\n";
+$out_loop_count = 0;
+foreach ($search_arrays_v as $search_array) {
+ $key_counter = 0;
+ $out_loop_count ++; echo "-- Iteration $out_loop_count --\n";
+ while ( $key_counter < $key_count ) {
+ $key = $key_variations[ $key_counter++ ];
+ var_dump( array_key_exists($key, $search_array) );
+ }
+}
+
+echo "\n*** Testing error conditions ***\n";
+//Zeor args
+var_dump( array_key_exists() );
+// first args as array
+var_dump( array_key_exists(array(), array()) );
+// second args as string
+var_dump( array_key_exists("", "") );
+// second args a integer
+var_dump( array_key_exists(1, 1) );
+// second args as NULL
+var_dump( array_key_exists(1, NULL) );
+// second args as boolean
+var_dump( array_key_exists(1, true) );
+// first args as boolean
+var_dump( array_key_exists(false, true) );
+// second args as float
+var_dump( array_key_exists(false, 17.5) );
+// args more than expected
+var_dump( array_key_exists(1, array(), array()) );
+// first argument as floating point value
+var_dump( array_key_exists(17.5, array(1,23) ) ) ;
+
+echo "\n*** Testing operation on objects ***\n";
+class key_check
+{
+ private $private_var = "Priviate var";
+ protected $protected_var = "Protected var";
+ public $public_var = "Public var";
+ public $arr = array("var" => "value", "1" => "one", ""=>"value");
+ public function print_member()
+ {
+ echo $this->$private_var."\n";
+ echo $this->$protected_var."\n";
+ echo $this->$public_var."\n";
+ }
+}
+
+$key_check_obj = new key_check; //new object
+/* array_key_exists() on an object, it should work on only public member variables */
+var_dump(array_key_exists("private_var", $key_check_obj)); // not found, private member
+var_dump(array_key_exists("protected_var", $key_check_obj)); // not found, private member
+var_dump(array_key_exists("public_var", $key_check_obj)); // found, public member
+var_dump(array_key_exists("print_member", $key_check_obj)); // not found, its a function
+var_dump(array_key_exists("arr", $key_check_obj)); //found, public member
+var_dump(array_key_exists("var", $key_check_obj->arr)); //found, key is in member array
+
+/* error condition, first arguemnt as object */
+var_dump( array_key_exists($key_check_obj, $key_check_obj) );
echo "Done\n";
?>
--EXPECTF--
+*** Testing basic functionalities ***
+-- Iteration 1 --
+bool(true)
+-- Iteration 2 --
+bool(false)
+-- Iteration 3 --
+bool(true)
+-- Iteration 4 --
+bool(false)
+-- Iteration 5 --
+bool(true)
+-- Iteration 6 --
+bool(true)
+-- Iteration 7 --
+bool(true)
+-- Iteration 8 --
+bool(true)
+
+*** Testing possible variations ***
+
+** Variation loop 1 **
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+** Variation loop 2 **
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+*** Testing error conditions ***
+
Warning: Wrong parameter count for array_key_exists() in %s on line %d
NULL
@@ -27,13 +257,35 @@ bool(false)
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
+bool(false)
+
+Warning: Wrong parameter count for array_key_exists() in %s on line %d
+NULL
+
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
+
+*** Testing operation on objects ***
bool(false)
-bool(true)
-bool(true)
bool(false)
bool(true)
bool(false)
+bool(true)
+bool(true)
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
bool(false)
diff --git a/ext/standard/tests/array/array_keys.phpt b/ext/standard/tests/array/array_keys.phpt
new file mode 100644
index 000000000..07bb3446b
--- /dev/null
+++ b/ext/standard/tests/array/array_keys.phpt
@@ -0,0 +1,466 @@
+--TEST--
+Test array_keys() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/*
+Prototype: array array_keys( array $input [, mixed $search_value [,
+ bool $strict]]);
+Description: Return all the keys of an array
+*/
+
+echo "*** Testing array_keys() on basic array operation ***\n";
+$basic_arr = array("a" => 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd",
+ array(1,2,3));
+var_dump(array_keys($basic_arr));
+
+echo "\n*** Testing array_keys() on various arrays ***";
+$arrays = array(
+ array(),
+ array(0),
+ array( array() ),
+ array("Hello" => "World"),
+ array("" => ""),
+ array(1,2,3, "d" => array(4,6, "d")),
+ array("a" => 1, "b" => 2, "c" =>3, "d" => array()),
+ array(0 => 0, 1 => 1, 2 => 2, 3 => 3),
+ array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000),
+ array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"),
+ array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ),
+ array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" )
+);
+
+$i = 0;
+/* loop through to test array_keys() with different arrays */
+foreach ($arrays as $array) {
+ echo "\n-- Iteration $i --\n";
+ var_dump(array_keys($array));
+ $i++;
+}
+
+echo "\n*** Testing array_keys() on all the types other than arrays ***";
+$types_arr = array(
+ TRUE => TRUE,
+ FALSE => FALSE,
+ 1 => 1,
+ 0 => 0,
+ -1 => -1,
+ "1" => "1",
+ "0" => "0",
+ "-1" => "-1",
+ NULL,
+ array(),
+ "php" => "php",
+ "" => ""
+);
+$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
+foreach ($values as $value){
+ echo "\n-- Loose type checking --\n";
+ var_dump(array_keys($types_arr, $value));
+ echo "\n-- strict type checking --\n";
+ var_dump(array_keys($types_arr, $value, TRUE));
+}
+
+echo "\n*** Testing array_keys() with resource type ***\n";
+$resource1 = fopen( __FILE__, "r");
+$resource2 = opendir( "." );
+
+/* creating an array with resource types as elements */
+$arr_resource = array($resource1, $resource2);
+
+var_dump(array_keys($arr_resource, $resource1)); // loose type checking
+var_dump(array_keys($arr_resource, $resource1, TRUE)); // strict type checking
+var_dump(array_keys($arr_resource, $resource2)); // loose type checking
+var_dump(array_keys($arr_resource, $resource2, TRUE)); // strict type checking
+
+echo "\n*** Testing array_keys() on range of values ***\n";
+$arr_range = array(
+ 2147483647 => 1,
+ 2147483648 => 2,
+ -2147483647 => 3,
+ -2147483648 => 4,
+ -2147483649 => 5,
+ -0 => 6,
+ 0 => 7
+);
+var_dump(array_keys($arr_range));
+
+echo "\n*** Testing array_keys() on an array created on the fly ***\n";
+var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
+var_dump(array_keys(array())); // null array
+
+echo "\n*** Testing error conditions ***";
+var_dump(array_keys(100));
+var_dump(array_keys("string"));
+var_dump(array_keys(new stdclass)); // object
+var_dump(array_keys()); // Zero arguments
+var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
+var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
+
+echo "Done\n";
+
+--CLEAN--
+/* Closing the resource handles */
+fclose( $resource1 );
+closedir( $resource2 );
+?>
+--EXPECTF--
+*** Testing array_keys() on basic array operation ***
+array(5) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ int(2)
+ [3]=>
+ int(-23)
+ [4]=>
+ int(3)
+}
+
+*** Testing array_keys() on various arrays ***
+-- Iteration 0 --
+array(0) {
+}
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(5) "Hello"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(5) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "a"
+ [3]=>
+ int(3)
+ [4]=>
+ int(5)
+}
+
+-- Iteration 9 --
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ string(0) ""
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(2) "ab"
+ [2]=>
+ string(2) "cd"
+}
+
+-- Iteration 11 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(0) ""
+}
+
+*** Testing array_keys() on all the types other than arrays ***
+-- Loose type checking --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(-1)
+ [2]=>
+ string(3) "php"
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "php"
+ [3]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- Loose type checking --
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(2)
+}
+
+-- Loose type checking --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(3)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+
+-- Loose type checking --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+*** Testing array_keys() with resource type ***
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Testing array_keys() on range of values ***
+array(4) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ int(-2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(0)
+}
+
+*** Testing array_keys() on an array created on the fly ***
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(0) {
+}
+
+*** Testing error conditions ***
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Illegal offset type in %s on line %d
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_keys_64bit.phpt b/ext/standard/tests/array/array_keys_64bit.phpt
new file mode 100644
index 000000000..3ffba0b4a
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_64bit.phpt
@@ -0,0 +1,472 @@
+--TEST--
+Test array_keys() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/*
+Prototype: array array_keys( array $input [, mixed $search_value [,
+ bool $strict]]);
+Description: Return all the keys of an array
+*/
+
+echo "*** Testing array_keys() on basic array operation ***\n";
+$basic_arr = array("a" => 1, "b" => 2, 2.0 => 2.0, -23.45 => "asdasd",
+ array(1,2,3));
+var_dump(array_keys($basic_arr));
+
+echo "\n*** Testing array_keys() on various arrays ***";
+$arrays = array(
+ array(),
+ array(0),
+ array( array() ),
+ array("Hello" => "World"),
+ array("" => ""),
+ array(1,2,3, "d" => array(4,6, "d")),
+ array("a" => 1, "b" => 2, "c" =>3, "d" => array()),
+ array(0 => 0, 1 => 1, 2 => 2, 3 => 3),
+ array(0.001=>3.000, 1.002=>2, 1.999=>3, "a"=>3, 3=>5, "5"=>3.000),
+ array(TRUE => TRUE, FALSE => FALSE, NULL => NULL, "\x000", "\000"),
+ array("a" => "abcd", "a" => "", "ab" => -6, "cd" => -0.5 ),
+ array(0 => array(), 1=> array(0), 2 => array(1), ""=> array(),""=>"" )
+);
+
+$i = 0;
+/* loop through to test array_keys() with different arrays */
+foreach ($arrays as $array) {
+ echo "\n-- Iteration $i --\n";
+ var_dump(array_keys($array));
+ $i++;
+}
+
+echo "\n*** Testing array_keys() on all the types other than arrays ***";
+$types_arr = array(
+ TRUE => TRUE,
+ FALSE => FALSE,
+ 1 => 1,
+ 0 => 0,
+ -1 => -1,
+ "1" => "1",
+ "0" => "0",
+ "-1" => "-1",
+ NULL,
+ array(),
+ "php" => "php",
+ "" => ""
+);
+$values = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "php", "");
+foreach ($values as $value){
+ echo "\n-- Loose type checking --\n";
+ var_dump(array_keys($types_arr, $value));
+ echo "\n-- strict type checking --\n";
+ var_dump(array_keys($types_arr, $value, TRUE));
+}
+
+echo "\n*** Testing array_keys() with resource type ***\n";
+$resource1 = fopen( __FILE__, "r");
+$resource2 = opendir( "." );
+
+/* creating an array with resource types as elements */
+$arr_resource = array($resource1, $resource2);
+
+var_dump(array_keys($arr_resource, $resource1)); // loose type checking
+var_dump(array_keys($arr_resource, $resource1, TRUE)); // strict type checking
+var_dump(array_keys($arr_resource, $resource2)); // loose type checking
+var_dump(array_keys($arr_resource, $resource2, TRUE)); // strict type checking
+
+echo "\n*** Testing array_keys() on range of values ***\n";
+$arr_range = array(
+ 2147483647 => 1,
+ 2147483648 => 2,
+ -2147483647 => 3,
+ -2147483648 => 4,
+ -2147483649 => 5,
+ -0 => 6,
+ 0 => 7
+);
+var_dump(array_keys($arr_range));
+
+echo "\n*** Testing array_keys() on an array created on the fly ***\n";
+var_dump(array_keys(array("a" => 1, "b" => 2, "c" => 3)));
+var_dump(array_keys(array())); // null array
+
+echo "\n*** Testing error conditions ***";
+var_dump(array_keys(100));
+var_dump(array_keys("string"));
+var_dump(array_keys(new stdclass)); // object
+var_dump(array_keys()); // Zero arguments
+var_dump(array_keys(array(), "", TRUE, 100)); // args > expected
+var_dump(array_keys(array(1,2,3, array() => array()))); // (W)illegal offset
+
+echo "Done\n";
+
+--CLEAN--
+/* Closing the resource handles */
+fclose( $resource1 );
+closedir( $resource2 );
+?>
+--EXPECTF--
+*** Testing array_keys() on basic array operation ***
+array(5) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ int(2)
+ [3]=>
+ int(-23)
+ [4]=>
+ int(3)
+}
+
+*** Testing array_keys() on various arrays ***
+-- Iteration 0 --
+array(0) {
+}
+
+-- Iteration 1 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 2 --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Iteration 3 --
+array(1) {
+ [0]=>
+ string(5) "Hello"
+}
+
+-- Iteration 4 --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+-- Iteration 5 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 6 --
+array(4) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+}
+
+-- Iteration 7 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ int(3)
+}
+
+-- Iteration 8 --
+array(5) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ string(1) "a"
+ [3]=>
+ int(3)
+ [4]=>
+ int(5)
+}
+
+-- Iteration 9 --
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ [2]=>
+ string(0) ""
+ [3]=>
+ int(2)
+ [4]=>
+ int(3)
+}
+
+-- Iteration 10 --
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(2) "ab"
+ [2]=>
+ string(2) "cd"
+}
+
+-- Iteration 11 --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+ [3]=>
+ string(0) ""
+}
+
+*** Testing array_keys() on all the types other than arrays ***
+-- Loose type checking --
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(-1)
+ [2]=>
+ string(3) "php"
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(4) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(2)
+ [2]=>
+ string(3) "php"
+ [3]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- strict type checking --
+array(0) {
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(-1)
+}
+
+-- Loose type checking --
+array(3) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+ [2]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(2)
+}
+
+-- Loose type checking --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(3)
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ int(3)
+}
+
+-- Loose type checking --
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ string(3) "php"
+}
+
+-- Loose type checking --
+array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ string(0) ""
+}
+
+-- strict type checking --
+array(1) {
+ [0]=>
+ string(0) ""
+}
+
+*** Testing array_keys() with resource type ***
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(0)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Testing array_keys() on range of values ***
+array(6) {
+ [0]=>
+ int(2147483647)
+ [1]=>
+ int(2147483648)
+ [2]=>
+ int(-2147483647)
+ [3]=>
+ int(-2147483648)
+ [4]=>
+ int(-2147483649)
+ [5]=>
+ int(0)
+}
+
+*** Testing array_keys() on an array created on the fly ***
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(0) {
+}
+
+*** Testing error conditions ***
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: array_keys(): The first argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_keys() in %s on line %d
+NULL
+
+Warning: Illegal offset type in %s on line %d
+array(3) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+ [2]=>
+ int(2)
+}
+Done
diff --git a/ext/standard/tests/array/array_map.phpt b/ext/standard/tests/array/array_map.phpt
new file mode 100644
index 000000000..78815e083
--- /dev/null
+++ b/ext/standard/tests/array/array_map.phpt
@@ -0,0 +1,423 @@
+--TEST--
+Test array_map() function
+--FILE--
+<?php
+/* Prototype: array array_map ( callback $callback, array $arr1 [, array $...] );
+ Description: array_map() returns an array containing all the elements of arr1
+ after applying the callback function to each one. The number of
+ parameters that the callback function accepts should match the
+ number of arrays passed to the array_map()
+*/
+
+echo "*** Testing basic operations ***\n";
+/* array_map with null as function and different arrays */
+var_dump( array_map(NULL, array()) );
+var_dump( array_map(NULL, array(), array()) );
+var_dump( array_map(NULL, array(1,2,3), array(1,2,3)) );
+var_dump( array_map(NULL, array(1,2), array(1,2,3,4)) );
+var_dump( array_map(NULL, array("Jan", "Feb", "March"), array("31","28","31")) );
+var_dump( array_map(NULL, array("Text", "Words", "Lineup"), array(4, 5, 6)) );
+var_dump( array_map(NULL, array("a", "ab", "abc", "abcd"), array()) );
+var_dump( array_map(NULL,
+ array("Jan"=>"01", "Feb"=>"02", "March"=>"03"),
+ array("31"=>"Jan", "28"=>"Feb", "031"=>"March")
+ )
+ );
+
+/* using key as "string" where no.of arguments passed to array_map() is 2 */
+var_dump( array_map( create_function('$n', 'return $n*$n;'),
+ array("key1"=>1, "key2"=>2, "key3"=>3)
+ )
+ );
+
+echo "\n*** Testing possible variations ***\n";
+/* anonymous callback function */
+var_dump( array_map( create_function('$a,$b', 'return $a+$b;'),
+ array(1,2,3),
+ array(5,6,7,8,9)
+ )
+ );
+
+/* anonymous callback function with reference */
+var_dump( array_map( create_function('&$a, $b', 'return array($a,$b);'),
+ array("Hello","Good"),
+ array("World","Day")
+ )
+ );
+
+/* callback function with reference */
+$a = array(1,2,3);
+function square(&$var) {
+ return( $var * $var );
+}
+print_r( array_map('square', $a) );
+
+/* array_map in recursion */
+function square_recur($var) {
+ if (is_array($var))
+ return array_map('square_recur', $var);
+ return $var * $var;
+}
+$rec_array = array(1, 2, array(3, 4, array(5, 2), array() ) );
+var_dump( array_map('square_recur', $rec_array) );
+
+/* callback function as string variable containing the function name */
+$string_var = "square";
+var_dump( array_map("square", $a) );
+var_dump( array_map($string_var, $a) );
+
+echo "\n*** Testing error conditions ***\n";
+/* arguments of non array type */
+$int_var=10;
+$float_var = 10.5;
+var_dump( array_map('square', $int_var) );
+var_dump( array_map('square', $float_var) );
+var_dump( array_map('square', $string_var) );
+
+/* Zero argument */
+var_dump( array_map() );
+
+/* use array(), echo(), empty(), eval(), exit(), isset(), list(), print()
+ and unset() as callback, failure expected */
+var_dump( array_map( 'echo', array(1) ) );
+var_dump( array_map( 'array', array(1) ) );
+var_dump( array_map( 'empty', array(1) ) );
+var_dump( array_map( 'eval', array(1) ) );
+var_dump( array_map( 'exit', array(1) ) );
+var_dump( array_map( 'isset', array(1) ) );
+var_dump( array_map( 'list', array(1) ) );
+var_dump( array_map( 'print', array(1) ) );
+
+
+echo "\n*** Testing operation on objects ***\n";
+/* array_map with class object */
+class check_array_map {
+ public static function helloWorld() {
+ return "Static_Function_helloWorld(): Hello World";
+ }
+ public function Message($v) {
+ return $v;
+ }
+
+ public static function Square( $n ) {
+ return $n * $n;
+ }
+}
+/* call static member function */
+var_dump( array_map( array('check_array_map', 'Square'), array(1,2,3)) );
+
+/* call non static member function - notice should be issues*/
+var_dump( array_map( array('check_array_map', 'Message'), array(1)) );
+
+/* call function using object */
+$obj = new check_array_map();
+var_dump( array_map( array($obj, 'helloWorld' ) ) ); // not enough args warning
+var_dump( array_map( array($obj, 'helloWorld'), array(1) ) );
+
+echo "Done\n";
+?>
+--EXPECTF--
+*** Testing basic operations ***
+array(0) {
+}
+array(0) {
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(3)
+ }
+}
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(2)
+ [1]=>
+ int(2)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ int(3)
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ int(4)
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(3) "Jan"
+ [1]=>
+ string(2) "31"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(3) "Feb"
+ [1]=>
+ string(2) "28"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(5) "March"
+ [1]=>
+ string(2) "31"
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(4) "Text"
+ [1]=>
+ int(4)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(5) "Words"
+ [1]=>
+ int(5)
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(6) "Lineup"
+ [1]=>
+ int(6)
+ }
+}
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ NULL
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(2) "ab"
+ [1]=>
+ NULL
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(3) "abc"
+ [1]=>
+ NULL
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(4) "abcd"
+ [1]=>
+ NULL
+ }
+}
+array(3) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(2) "01"
+ [1]=>
+ string(3) "Jan"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(2) "02"
+ [1]=>
+ string(3) "Feb"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(2) "03"
+ [1]=>
+ string(5) "March"
+ }
+}
+array(3) {
+ ["key1"]=>
+ int(1)
+ ["key2"]=>
+ int(4)
+ ["key3"]=>
+ int(9)
+}
+
+*** Testing possible variations ***
+array(5) {
+ [0]=>
+ int(6)
+ [1]=>
+ int(8)
+ [2]=>
+ int(10)
+ [3]=>
+ int(8)
+ [4]=>
+ int(9)
+}
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(5) "Hello"
+ [1]=>
+ string(5) "World"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(4) "Good"
+ [1]=>
+ string(3) "Day"
+ }
+}
+Array
+(
+ [0] => 1
+ [1] => 4
+ [2] => 9
+)
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+ [2]=>
+ array(4) {
+ [0]=>
+ int(9)
+ [1]=>
+ int(16)
+ [2]=>
+ array(2) {
+ [0]=>
+ int(25)
+ [1]=>
+ int(4)
+ }
+ [3]=>
+ array(0) {
+ }
+ }
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+ [2]=>
+ int(9)
+}
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+ [2]=>
+ int(9)
+}
+
+*** Testing error conditions ***
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+
+Warning: array_map(): Argument #2 should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_map() %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'echo', should be either NULL or a valid callback in %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'array', should be either NULL or a valid callback in %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'empty', should be either NULL or a valid callback in %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'eval', should be either NULL or a valid callback in %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'exit', should be either NULL or a valid callback in %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'isset', should be either NULL or a valid callback in %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'list', should be either NULL or a valid callback in %s on line %d
+NULL
+
+Warning: array_map(): The first argument, 'print', should be either NULL or a valid callback in %s on line %d
+NULL
+
+*** Testing operation on objects ***
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(4)
+ [2]=>
+ int(9)
+}
+
+Strict Standards: Non-static method check_array_map::Message() cannot be called statically in %s on line %d
+
+Strict Standards: Non-static method check_array_map::Message() cannot be called statically in %s on line %d
+array(1) {
+ [0]=>
+ int(1)
+}
+
+Warning: Wrong parameter count for array_map() in %s on line %d
+NULL
+array(1) {
+ [0]=>
+ string(41) "Static_Function_helloWorld(): Hello World"
+}
+Done
diff --git a/ext/standard/tests/array/array_pop.phpt b/ext/standard/tests/array/array_pop.phpt
new file mode 100644
index 000000000..544be2211
--- /dev/null
+++ b/ext/standard/tests/array/array_pop.phpt
@@ -0,0 +1,286 @@
+--TEST--
+Test array_pop() function
+--FILE--
+<?php
+
+/* Prototype: mixed array_pop( array &array );
+ * Description: Pops and returns the last value of the array.
+ */
+
+array_pop($GLOBALS);
+
+$empty_array = array();
+$number = 5;
+$str = "abc";
+
+
+/* Various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "_Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+/* Testing Error Conditions */
+echo "\n*** Testing Error Conditions ***\n";
+
+/* Zero argument */
+var_dump( array_pop() );
+
+/* Scalar argument */
+var_dump( array_pop($number) );
+
+/* String argument */
+var_dump( array_pop($str) );
+
+/* Invalid Number of arguments */
+var_dump( array_pop($mixed_array[1],$mixed_array[2]) );
+
+/* Empty Array as argument */
+var_dump( array_pop($empty_array) );
+
+/* Loop to test normal functionality with different arrays inputs */
+echo "\n*** Normal testing with various array inputs ***\n";
+
+$counter = 1;
+foreach( $mixed_array as $sub_array )
+{
+ echo "\n-- Input Array for Iteration $counter is --\n";
+ print_r( $sub_array );
+ echo "\nOutput after Pop is :\n";
+ var_dump( array_pop($sub_array) );
+ $counter++;
+}
+
+echo"\n*** Checking for internal array pointer being reset when pop is called ***\n";
+
+echo "\nCurrent Element is : ";
+var_dump( current($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nNext Element is : ";
+var_dump( next($mixed_array[1]) );
+
+echo "\nPOPed Element is : ";
+var_dump( array_pop($mixed_array[1]) );
+
+echo "\nCurrent Element after POP operation is: ";
+var_dump( current($mixed_array[1]) );
+
+echo"\nDone";
+?>
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for array_pop() in %s on line %d
+NULL
+
+Warning: array_pop(): The argument should be an array in %s on line %d
+NULL
+
+Warning: array_pop(): The argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for array_pop() in %s on line %d
+NULL
+NULL
+
+*** Normal testing with various array inputs ***
+
+-- Input Array for Iteration 1 is --
+Array
+(
+)
+
+Output after Pop is :
+NULL
+
+-- Input Array for Iteration 2 is --
+Array
+(
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ [3] => 4
+ [4] => 5
+ [5] => 6
+ [6] => 7
+ [7] => 8
+ [8] => 9
+)
+
+Output after Pop is :
+int(9)
+
+-- Input Array for Iteration 3 is --
+Array
+(
+ [0] => One
+ [1] => _Two
+ [2] => Three
+ [3] => Four
+ [4] => Five
+)
+
+Output after Pop is :
+string(4) "Five"
+
+-- Input Array for Iteration 4 is --
+Array
+(
+ [0] => 6
+ [1] => six
+ [2] => 7
+ [3] => seven
+ [4] => 8
+ [5] => eight
+ [6] => 9
+ [7] => nine
+)
+
+Output after Pop is :
+string(4) "nine"
+
+-- Input Array for Iteration 5 is --
+Array
+(
+ [a] => aaa
+ [A] => AAA
+ [c] => ccc
+ [d] => ddd
+ [e] => eee
+)
+
+Output after Pop is :
+string(3) "eee"
+
+-- Input Array for Iteration 6 is --
+Array
+(
+ [1] => one
+ [2] => two
+ [3] => three
+ [4] => four
+ [5] => five
+)
+
+Output after Pop is :
+string(4) "five"
+
+-- Input Array for Iteration 7 is --
+Array
+(
+ [1] => one
+ [2] => two
+ [3] => 7
+ [4] => four
+ [5] => five
+)
+
+Output after Pop is :
+string(4) "five"
+
+-- Input Array for Iteration 8 is --
+Array
+(
+ [f] => fff
+ [1] => one
+ [4] => 6
+ [] => 3
+ [2] => float
+ [F] => FFF
+ [blank] =>
+ [3] => 3.7
+ [5] => Five
+ [6] => 8.6
+ [4name] => jonny
+ [a] =>
+)
+
+Output after Pop is :
+NULL
+
+-- Input Array for Iteration 9 is --
+Array
+(
+ [0] => 12
+ [1] => name
+ [2] => age
+ [3] => 45
+)
+
+Output after Pop is :
+string(2) "45"
+
+-- Input Array for Iteration 10 is --
+Array
+(
+ [0] => Array
+ (
+ [0] => oNe
+ [1] => tWo
+ [2] => 4
+ )
+
+ [1] => Array
+ (
+ [0] => 10
+ [1] => 20
+ [2] => 30
+ [3] => 40
+ [4] => 50
+ )
+
+ [2] => Array
+ (
+ )
+
+)
+
+Output after Pop is :
+array(0) {
+}
+
+-- Input Array for Iteration 11 is --
+Array
+(
+ [one] => 2
+ [three] => 3
+ [0] => 3
+ [1] => 4
+ [3] => 33
+ [4] => 44
+ [5] => 57
+ [6] => 6
+ [5.4] => 554
+ [5.7] => 557
+)
+
+Output after Pop is :
+int(557)
+
+*** Checking for internal array pointer being reset when pop is called ***
+
+Current Element is : int(1)
+
+Next Element is : int(2)
+
+Next Element is : int(3)
+
+POPed Element is : int(9)
+
+Current Element after POP operation is: int(1)
+
+Done
diff --git a/ext/standard/tests/array/array_search.phpt b/ext/standard/tests/array/array_search.phpt
index e95fda128..f6712eee9 100644
--- a/ext/standard/tests/array/array_search.phpt
+++ b/ext/standard/tests/array/array_search.phpt
@@ -1,7 +1,13 @@
--TEST--
-search_array and in_array (including bug 13567)
+Test array_search() and in_array() functions (including bug 13567)
--FILE--
<?php
+/* Prototype: bool in_array ( mixed $needle, array $haystack [, bool $strict] );
+ Description: Checks if a value exists in an array
+ Searches haystack for needle and returns TRUE if found in array, FALSE otherwise.
+ If the third parameter strict is set to TRUE then the in_array() function
+ will also check the types of the needle in the haystack.
+*/
$arr1 = array('a','b','c');
$arr2 = array();
@@ -9,6 +15,7 @@ $arr3 = array('c','key'=>'d');
$arr4 = array("a\0b"=>'e','key'=>'d', 'f');
$tests = <<<TESTS
+FALSE === in_array(123, \$arr2)
FALSE === in_array(123, \$arr1)
FALSE === array_search(123, \$arr1)
TRUE === in_array('a', \$arr1)
@@ -19,5 +26,862 @@ TESTS;
include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
---EXPECT--
+/* checking for STRICT option in in_array() */
+echo "\n*** Testing STRICT option of in_array() on arrays ***\n";
+$arrays = array (
+ array(0),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"),
+ array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9),
+ array(TRUE, FALSE),
+ array("", array()),
+ array("abcd\x00abcd\x00abcd"),
+ array("abcd\tabcd\nabcd\rabcd\0abcdefghij")
+);
+
+$array_compare = array (
+ 4,
+ "4",
+ 4.00,
+ "b",
+ "5",
+ -2,
+ -2.0,
+ -2.98989,
+ "-.9",
+ "True",
+ "",
+ array(),
+ NULL,
+ "ab",
+ "abcd",
+ 0.0,
+ -0,
+ "abcd\x00abcd\x00abcd"
+);
+/* loop to check if elements in $array_compare exist in $arrays
+ using in_array() */
+$counter = 1;
+foreach($arrays as $array) {
+ foreach($array_compare as $compare) {
+ echo "-- Iteration $counter --\n";
+ //strict option OFF
+ var_dump(in_array($compare,$array));
+ //strict option ON
+ var_dump(in_array($compare,$array,TRUE));
+ //strict option OFF
+ var_dump(in_array($compare,$array,FALSE));
+ $counter++;
+ }
+}
+
+/* checking loose and strict TYPE comparisons in in_array() */
+echo "\n*** Testing loose and strict TYPE comparison of in_array() ***\n";
+$misc_array = array (
+ 'a',
+ 'key' =>'d',
+ 3,
+ ".001" =>-67,
+ "-.051" =>"k",
+ 0.091 =>"-.08",
+ "e" =>"5",
+ "y" =>NULL,
+ NULL =>"",
+ 0,
+ TRUE,
+ FALSE,
+ -27.39999999999,
+ " ",
+ "abcd\x00abcd\x00\abcd\x00abcdefghij",
+ "abcd\nabcd\tabcd\rabcd\0abcd"
+);
+$array_type = array(TRUE, FALSE, 1, 0, -1, "1", "0", "-1", NULL, array(), "PHP", "");
+/* loop to do loose and strict type check of elements in
+ $array_type on elements in $misc_array using in_array();
+ checking PHP type comparison tables
+*/
+$counter = 1;
+foreach($array_type as $type) {
+ echo "-- Iteration $counter --\n";
+ //loose type checking
+ var_dump( in_array($type,$misc_array ) );
+ //strict type checking
+ var_dump( in_array($type,$misc_array,true) );
+ //loose type checking
+ var_dump( in_array($type,$misc_array,false) );
+ $counter++;
+}
+
+/* checking for sub-arrays with in_array() */
+echo "\n*** Testing sub-arrays with in_array() ***\n";
+$sub_array = array (
+ "one",
+ array(1, 2 => "two", "three" => 3),
+ 4 => "four",
+ "five" => 5,
+ array('', 'i')
+);
+var_dump( in_array("four", $sub_array) );
+//checking for element in a sub-array
+var_dump( in_array(3, $sub_array[1]) );
+var_dump( in_array(array('','i'), $sub_array) );
+
+/* checking for objects in in_array() */
+echo "\n*** Testing objects with in_array() ***\n";
+class in_array_check {
+ public $array_var = array(1=>"one", "two"=>2, 3=>3);
+ public function foo() {
+ echo "Public function\n";
+ }
+}
+
+$in_array_obj = new in_array_check(); //creating new object
+//error: as wrong datatype for second argument
+var_dump( in_array("array_var", $in_array_obj) );
+//error: as wrong datatype for second argument
+var_dump( in_array("foo", $in_array_obj) );
+//element found as "one" exists in array $array_var
+var_dump( in_array("one", $in_array_obj->array_var) );
+
+/* checking for Resources */
+echo "\n*** Testing resource type with in_array() ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array for comparision.
+$resources = array($file_handle, $dir_handle);
+
+// search for resouce type in the resource array
+var_dump( in_array($file_handle, $resources, true) );
+//checking for (int) type resource
+var_dump( in_array((int)$dir_handle, $resources, true) );
+
+/* Miscellenous input check */
+echo "\n*** Testing miscelleneos inputs with in_array() ***\n";
+//matching "Good" in array(0,"hello"), result:true in loose type check
+var_dump( in_array("Good", array(0,"hello")) );
+//false in strict mode
+var_dump( in_array("Good", array(0,"hello"), TRUE) );
+
+//matching integer 0 in array("this"), result:true in loose type check
+var_dump( in_array(0, array("this")) );
+// false in strict mode
+var_dump( in_array(0, array("this")),TRUE );
+
+//matching string "this" in array(0), result:true in loose type check
+var_dump( in_array("this", array(0)) );
+// false in stric mode
+var_dump( in_array("this", array(0), TRUE) );
+
+//checking for type FALSE in multidimensional array with loose checking, result:false in loose type check
+var_dump( in_array(FALSE,
+ array("a"=> TRUE, "b"=> TRUE,
+ array("c"=> TRUE, "d"=>TRUE)
+ )
+ )
+ );
+
+//matching string having integer in beginning, result:true in loose type check
+var_dump( in_array('123abc', array(123)) );
+var_dump( in_array('123abc', array(123), TRUE) ); // false in strict mode
+
+echo "\n*** Testing error conditions of in_array() ***\n";
+/* zero argument */
+var_dump( in_array() );
+
+/* unexpected no.of arguments in in_array() */
+$var = array("mon", "tues", "wed", "thurs");
+var_dump( in_array(1, $var, 0, "test") );
+var_dump( in_array("test") );
+
+/* unexpected second argument in in_array() */
+$var="test";
+var_dump( in_array("test", $var) );
+var_dump( in_array(1, 123) );
+
+/* closing resource handles */
+fclose($file_handle);
+closedir($dir_handle);
+
+echo "Done\n";
+?>
+--EXPECTF--
OK
+*** Testing STRICT option of in_array() on arrays ***
+-- Iteration 1 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 2 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 3 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 4 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 5 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 6 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 7 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 8 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 9 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 10 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 12 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 13 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 14 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 15 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 16 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 17 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 18 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 19 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 20 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 21 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 22 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 23 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 24 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 25 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 26 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 27 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 28 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 29 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 30 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 31 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 32 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 33 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 34 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 35 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 36 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 37 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 38 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 39 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 40 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 41 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 42 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 43 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 44 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 45 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 46 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 47 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 48 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 49 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 50 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 51 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 52 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 53 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 54 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 55 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 56 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 57 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 58 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 59 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 60 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 61 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 62 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 63 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 64 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 65 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 66 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 67 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 68 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 69 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 70 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 71 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 72 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 73 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 74 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 75 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 76 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 77 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 78 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 79 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 80 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 81 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 82 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 83 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 84 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 85 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 86 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 87 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 88 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 89 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 90 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 91 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 92 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 93 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 94 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 95 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 96 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 97 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 98 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 99 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 100 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 101 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 102 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 103 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 104 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 105 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 106 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 107 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 108 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 109 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 110 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 111 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 112 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 113 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 114 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 115 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 116 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 117 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 118 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 119 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 120 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 121 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 122 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 123 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 124 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 125 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 126 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 127 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 128 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 129 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 130 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 131 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 132 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 133 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 134 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 135 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 136 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 137 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 138 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 139 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 140 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 141 --
+bool(false)
+bool(false)
+bool(false)
+-- Iteration 142 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 143 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 144 --
+bool(false)
+bool(false)
+bool(false)
+
+*** Testing loose and strict TYPE comparison of in_array() ***
+-- Iteration 1 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 2 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 3 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 4 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 5 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 6 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 7 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 8 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 9 --
+bool(true)
+bool(true)
+bool(true)
+-- Iteration 10 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 11 --
+bool(true)
+bool(false)
+bool(true)
+-- Iteration 12 --
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing sub-arrays with in_array() ***
+bool(true)
+bool(true)
+bool(true)
+
+*** Testing objects with in_array() ***
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+bool(true)
+
+*** Testing resource type with in_array() ***
+bool(true)
+bool(false)
+
+*** Testing miscelleneos inputs with in_array() ***
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+
+*** Testing error conditions of in_array() ***
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for in_array() in %s on line %d
+NULL
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+
+Warning: in_array(): Wrong datatype for second argument in %s on line %d
+bool(false)
+Done
diff --git a/ext/standard/tests/array/array_values.phpt b/ext/standard/tests/array/array_values.phpt
index 42e252ac8..0aeb5a85a 100644
--- a/ext/standard/tests/array/array_values.phpt
+++ b/ext/standard/tests/array/array_values.phpt
Binary files differ
diff --git a/ext/standard/tests/array/array_values_64bit.phpt b/ext/standard/tests/array/array_values_64bit.phpt
new file mode 100644
index 000000000..a04880001
--- /dev/null
+++ b/ext/standard/tests/array/array_values_64bit.phpt
Binary files differ
diff --git a/ext/standard/tests/array/bug28974.phpt b/ext/standard/tests/array/bug28974.phpt
index fb272e1d7..a2bd86f6d 100644
--- a/ext/standard/tests/array/bug28974.phpt
+++ b/ext/standard/tests/array/bug28974.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #28974 array_(p)slice() treats large lengths incorrectly - overflow
+Bug #28974 (array_(p)slice() treats large lengths incorrectly - overflow)
--FILE--
<?php
$a = $b = $c = array(0,1,2,3,4,5);
diff --git a/ext/standard/tests/array/bug29253.phpt b/ext/standard/tests/array/bug29253.phpt
index b2202a104..749b0aa9f 100755
--- a/ext/standard/tests/array/bug29253.phpt
+++ b/ext/standard/tests/array/bug29253.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #29253 array_diff with $GLOBALS argument fails
+Bug #29253 (array_diff with $GLOBALS argument fails)
--FILE--
<?php
$zz = $GLOBALS;
diff --git a/ext/standard/tests/array/bug33940.phpt b/ext/standard/tests/array/bug33940.phpt
index f1aba87bd..3dd45f39b 100755
--- a/ext/standard/tests/array/bug33940.phpt
+++ b/ext/standard/tests/array/bug33940.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #33940 array_map() fails to pass by reference when called recursively
+Bug #33940 (array_map() fails to pass by reference when called recursively)
--INI--
error_reporting=4095
allow_call_time_pass_reference=1
diff --git a/ext/standard/tests/array/bug34982.phpt b/ext/standard/tests/array/bug34982.phpt
index bcfed5938..90240965f 100755
--- a/ext/standard/tests/array/bug34982.phpt
+++ b/ext/standard/tests/array/bug34982.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #34982 array_walk_recursive() modifies elements outside function scope
+Bug #34982 (array_walk_recursive() modifies elements outside function scope)
--FILE--
<?php
$ar = array(
diff --git a/ext/standard/tests/array/each.phpt b/ext/standard/tests/array/each.phpt
new file mode 100644
index 000000000..1953a0439
--- /dev/null
+++ b/ext/standard/tests/array/each.phpt
Binary files differ
diff --git a/ext/standard/tests/array/end.phpt b/ext/standard/tests/array/end.phpt
new file mode 100644
index 000000000..da9422395
--- /dev/null
+++ b/ext/standard/tests/array/end.phpt
@@ -0,0 +1,238 @@
+--TEST--
+Test end() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: mixed end ( array &$array );
+ Description: Advances internal pointer of array to last element, and returns its value.
+*/
+
+$arrays = array (
+ array( 0 ),
+ range(1, 100 ),
+ range('a', 'z', 2 ),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ),
+ array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ),
+ array(1.0005, 2.000000, -3.000000, -4.9999999 ),
+ array(true, false),
+ array("PHP", "Web2.0", "SOA"),
+ array(1, array() ),
+ array(1, 2, "" ),
+ array(" "),
+ array(2147483647, 2147483648, -2147483647, -2147483648 ),
+ array(0x7FFFFFFF, -0x80000000, 017777777777, -020000000000 ),
+ array(-.6700000E+3, -4.10003E+3, 1e-5, -1E+5, 000002.00 )
+);
+/* loop through $arrays to print the last element of each sub-array */
+echo "*** Testing end() on different arrays ***\n";
+$counter = 1;
+foreach ($arrays as $sub_array){
+ echo "-- Iteration $counter --\n";
+ var_dump( end($sub_array) );
+ /* ensure that internal pointer is moved to last element */
+ var_dump( current($sub_array) );
+ $counter++;
+}
+
+/* checking for end() on sub-arrays */
+echo "\n*** Testing end() with sub-arrays ***\n";
+$test_array = array(1, array(1 => "one", "two" => 2, "" => "f") );
+var_dump( end($test_array) );
+var_dump( end($test_array[1]) );
+
+/* checking working of end() when array elements are deleted */
+echo "\n*** Testing end() when array elements are deleted ***\n";
+$array_test = array("a", "b", "d", 7, "u" => "U", -4, "-.008" => "neg.008");
+
+// remove first element from array
+echo "\n-- Remove first element from array --\n";
+unset($array_test[0]);
+var_dump( end($array_test) );
+
+// remove last element from array, rewind and check end()
+echo "\n-- Remove last element from array --\n";
+unset($array_test['-.008']);
+var_dump( end($array_test) );
+reset( $array_test );
+var_dump( end($array_test) );
+
+// remove any element !first, !last, rewind and check end()
+echo "\n-- Remove any element from array apart from first and last element --\n";
+unset($array_test[7]);
+var_dump( end($array_test) );
+var_dump( reset($array_test) );
+var_dump( end($array_test) );
+
+/* Checking on OBJECTS type */
+echo "\n*** Testing end() on objects ***\n";
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+class foo1
+{
+ function __toString() {
+ return "Object1";
+ }
+}
+
+$object1 = new foo(); //new object created
+$object2 = new foo1();
+
+$array_object = array();
+$array_object[0] = &$object1;
+$array_object[1] = &$object2;
+var_dump( end($array_object) );
+var_dump($array_object);
+
+/* Checking on RESOURCE type */
+echo "\n*** Testing end() on resource type ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array
+$resources = array($file_handle, $dir_handle);
+var_dump( end($resources) );
+var_dump( current($resources) );
+
+echo "\n*** Testing error conditions ***\n";
+/* checking for unexpected number of arguments */
+var_dump( end() );
+var_dump( end($array[0], $array[0]) );
+
+/* checking for unexpected type of arguments */
+$var=1;
+$var1="string";
+var_dump( end($var) );
+var_dump( end($var1) );
+
+/* checking null array */
+$null_array = array();
+var_dump( end($null_array) );
+
+echo "Done\n";
+
+?>
+
+--CLEAN--
+/* cleaning resource handles */
+fclose( $file_handle ); //file resource handle deleted
+closedir( $dir_handle ); //dir resource handle deleted
+
+--EXPECTF--
+*** Testing end() on different arrays ***
+-- Iteration 1 --
+int(0)
+int(0)
+-- Iteration 2 --
+int(100)
+int(100)
+-- Iteration 3 --
+string(1) "y"
+string(1) "y"
+-- Iteration 4 --
+NULL
+NULL
+-- Iteration 5 --
+int(5)
+int(5)
+-- Iteration 6 --
+float(-0.9)
+float(-0.9)
+-- Iteration 7 --
+float(-4.9999999)
+float(-4.9999999)
+-- Iteration 8 --
+bool(false)
+bool(false)
+-- Iteration 9 --
+string(3) "SOA"
+string(3) "SOA"
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 11 --
+string(0) ""
+string(0) ""
+-- Iteration 12 --
+string(1) " "
+string(1) " "
+-- Iteration 13 --
+float(-2147483648)
+float(-2147483648)
+-- Iteration 14 --
+float(-2147483648)
+float(-2147483648)
+-- Iteration 15 --
+float(2)
+float(2)
+
+*** Testing end() with sub-arrays ***
+array(3) {
+ [1]=>
+ string(3) "one"
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(1) "f"
+}
+string(1) "f"
+
+*** Testing end() when array elements are deleted ***
+
+-- Remove first element from array --
+string(7) "neg.008"
+
+-- Remove last element from array --
+int(-4)
+int(-4)
+
+-- Remove any element from array apart from first and last element --
+int(-4)
+string(1) "b"
+int(-4)
+
+*** Testing end() on objects ***
+object(foo1)#%d (0) {
+}
+array(2) {
+ [0]=>
+ &object(foo)#%d (0) {
+ }
+ [1]=>
+ &object(foo1)#%d (0) {
+ }
+}
+
+*** Testing end() on resource type ***
+resource(%d) of type (stream)
+resource(%d) of type (stream)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/array/end_64bit.phpt b/ext/standard/tests/array/end_64bit.phpt
new file mode 100644
index 000000000..94fff0c1c
--- /dev/null
+++ b/ext/standard/tests/array/end_64bit.phpt
@@ -0,0 +1,238 @@
+--TEST--
+Test end() function
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype: mixed end ( array &$array );
+ Description: Advances internal pointer of array to last element, and returns its value.
+*/
+
+$arrays = array (
+ array( 0 ),
+ range(1, 100 ),
+ range('a', 'z', 2 ),
+ array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL ),
+ array(1, array(1, 2 => 3 ), "one" => 1, "5" => 5 ),
+ array(-1, -2, -3, -4, "-0.005" => "neg0.005", 2.0 => "float2", "neg.9" => -.9 ),
+ array(1.0005, 2.000000, -3.000000, -4.9999999 ),
+ array(true, false),
+ array("PHP", "Web2.0", "SOA"),
+ array(1, array() ),
+ array(1, 2, "" ),
+ array(" "),
+ array(2147483647, 2147483648, -2147483647, -2147483648 ),
+ array(0x7FFFFFFF, -0x80000000, 017777777777, -020000000000 ),
+ array(-.6700000E+3, -4.10003E+3, 1e-5, -1E+5, 000002.00 )
+);
+/* loop through $arrays to print the last element of each sub-array */
+echo "*** Testing end() on different arrays ***\n";
+$counter = 1;
+foreach ($arrays as $sub_array){
+ echo "-- Iteration $counter --\n";
+ var_dump( end($sub_array) );
+ /* ensure that internal pointer is moved to last element */
+ var_dump( current($sub_array) );
+ $counter++;
+}
+
+/* checking for end() on sub-arrays */
+echo "\n*** Testing end() with sub-arrays ***\n";
+$test_array = array(1, array(1 => "one", "two" => 2, "" => "f") );
+var_dump( end($test_array) );
+var_dump( end($test_array[1]) );
+
+/* checking working of end() when array elements are deleted */
+echo "\n*** Testing end() when array elements are deleted ***\n";
+$array_test = array("a", "b", "d", 7, "u" => "U", -4, "-.008" => "neg.008");
+
+// remove first element from array
+echo "\n-- Remove first element from array --\n";
+unset($array_test[0]);
+var_dump( end($array_test) );
+
+// remove last element from array, rewind and check end()
+echo "\n-- Remove last element from array --\n";
+unset($array_test['-.008']);
+var_dump( end($array_test) );
+reset( $array_test );
+var_dump( end($array_test) );
+
+// remove any element !first, !last, rewind and check end()
+echo "\n-- Remove any element from array apart from first and last element --\n";
+unset($array_test[7]);
+var_dump( end($array_test) );
+var_dump( reset($array_test) );
+var_dump( end($array_test) );
+
+/* Checking on OBJECTS type */
+echo "\n*** Testing end() on objects ***\n";
+class foo
+{
+ function __toString() {
+ return "Object";
+ }
+}
+class foo1
+{
+ function __toString() {
+ return "Object1";
+ }
+}
+
+$object1 = new foo(); //new object created
+$object2 = new foo1();
+
+$array_object = array();
+$array_object[0] = &$object1;
+$array_object[1] = &$object2;
+var_dump( end($array_object) );
+var_dump($array_object);
+
+/* Checking on RESOURCE type */
+echo "\n*** Testing end() on resource type ***\n";
+//file type resource
+$file_handle = fopen(__FILE__, "r");
+
+//directory type resource
+$dir_handle = opendir( dirname(__FILE__) );
+
+//store resources in array
+$resources = array($file_handle, $dir_handle);
+var_dump( end($resources) );
+var_dump( current($resources) );
+
+echo "\n*** Testing error conditions ***\n";
+/* checking for unexpected number of arguments */
+var_dump( end() );
+var_dump( end($array[0], $array[0]) );
+
+/* checking for unexpected type of arguments */
+$var=1;
+$var1="string";
+var_dump( end($var) );
+var_dump( end($var1) );
+
+/* checking null array */
+$null_array = array();
+var_dump( end($null_array) );
+
+echo "Done\n";
+
+?>
+
+--CLEAN--
+/* cleaning resource handles */
+fclose( $file_handle ); //file resource handle deleted
+closedir( $dir_handle ); //dir resource handle deleted
+
+--EXPECTF--
+*** Testing end() on different arrays ***
+-- Iteration 1 --
+int(0)
+int(0)
+-- Iteration 2 --
+int(100)
+int(100)
+-- Iteration 3 --
+string(1) "y"
+string(1) "y"
+-- Iteration 4 --
+NULL
+NULL
+-- Iteration 5 --
+int(5)
+int(5)
+-- Iteration 6 --
+float(-0.9)
+float(-0.9)
+-- Iteration 7 --
+float(-4.9999999)
+float(-4.9999999)
+-- Iteration 8 --
+bool(false)
+bool(false)
+-- Iteration 9 --
+string(3) "SOA"
+string(3) "SOA"
+-- Iteration 10 --
+array(0) {
+}
+array(0) {
+}
+-- Iteration 11 --
+string(0) ""
+string(0) ""
+-- Iteration 12 --
+string(1) " "
+string(1) " "
+-- Iteration 13 --
+int(-2147483648)
+int(-2147483648)
+-- Iteration 14 --
+int(-2147483648)
+int(-2147483648)
+-- Iteration 15 --
+float(2)
+float(2)
+
+*** Testing end() with sub-arrays ***
+array(3) {
+ [1]=>
+ string(3) "one"
+ ["two"]=>
+ int(2)
+ [""]=>
+ string(1) "f"
+}
+string(1) "f"
+
+*** Testing end() when array elements are deleted ***
+
+-- Remove first element from array --
+string(7) "neg.008"
+
+-- Remove last element from array --
+int(-4)
+int(-4)
+
+-- Remove any element from array apart from first and last element --
+int(-4)
+string(1) "b"
+int(-4)
+
+*** Testing end() on objects ***
+object(foo1)#2 (0) {
+}
+array(2) {
+ [0]=>
+ &object(foo)#1 (0) {
+ }
+ [1]=>
+ &object(foo1)#2 (0) {
+ }
+}
+
+*** Testing end() on resource type ***
+resource(6) of type (stream)
+resource(6) of type (stream)
+
+*** Testing error conditions ***
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for end() in %s on line %d
+NULL
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+
+Warning: end(): Passed variable is not an array or object in %s on line %d
+bool(false)
+bool(false)
+Done
diff --git a/ext/standard/tests/array/extract.phpt b/ext/standard/tests/array/extract.phpt
new file mode 100644
index 000000000..d9b37c859
--- /dev/null
+++ b/ext/standard/tests/array/extract.phpt
@@ -0,0 +1,276 @@
+--TEST--
+Test extract() function
+--FILE--
+<?php
+/* Prototype: int extract( array var_array[, int extract_type[, string prefix]] )
+ * Description: Import variables into the current symbol table from an array
+ */
+
+/* various combinations of arrays to be used for the test */
+$mixed_array = array(
+ array(),
+ array( 1,2,3,4,5,6,7,8,9 ),
+ array( "One", "Two", "Three", "Four", "Five" ),
+ array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
+ array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
+ array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
+ array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
+ array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
+ "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
+ array( 12, "name", 'age', '45' ),
+ array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
+ array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
+ 5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
+);
+
+$val = 4;
+$str = "John";
+
+/* Extracting Global Variables */
+extract($GLOBALS, EXTR_REFS);
+
+/* Testing Error Conditions */
+echo "*** Testing Error Conditions ***\n";
+
+/* Zero Arguments */
+var_dump( extract() );
+
+/* Invalid second argument ( only 0-6 is valid) */
+var_dump( extract($mixed_array[7], -1 . "wddr") );
+var_dump( extract($mixed_array[7], 7 , "wddr") );
+
+/* scalar argument */
+var_dump( extract($val) );
+
+/* string argument */
+var_dump( extract($str) );
+
+/* More than valid number of arguments i.e. 3 args */
+var_dump( extract($mixed_array[7], EXTR_SKIP, "aa", "ee") );
+
+/* Two Arguments, second as prefix but without prefix string as third argument */
+var_dump( extract($mixed_array[7],EXTR_PREFIX_IF_EXISTS) );
+
+$counter = 0;
+
+foreach ( $mixed_array as $sub_array ) {
+ echo "\n-- Iteration $counter --\n";
+ $counter++;
+
+ var_dump ( extract($sub_array)); /* Single Argument */
+
+ /* variations of two arguments */
+ var_dump ( extract($sub_array, EXTR_OVERWRITE));
+ var_dump ( extract($sub_array, EXTR_SKIP));
+ var_dump ( extract($sub_array, EXTR_IF_EXISTS));
+
+ /* variations of three arguments with use of various extract types*/
+ var_dump ( extract($sub_array, EXTR_PREFIX_INVALID, "ssd"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_SAME, "sss"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "bb"));
+ var_dump ( extract($sub_array, EXTR_PREFIX_ALL, "")); // "_" taken as default prefix
+ var_dump ( extract($sub_array, EXTR_PREFIX_IF_EXISTS, "bb"));
+}
+
+
+/* EXTR_REFS as second Argument */
+$a = array ('foo' => 'aaa');
+var_dump ( extract($a, EXTR_REFS));
+$b = $a;
+$b['foo'] = 'bbb';
+var_dump ( extract($a, EXTR_REFS));
+
+/* EXTR_PREFIX_ALL called twice with same prefix string */
+echo "\n*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***\n";
+var_dump ( extract($mixed_array[5], EXTR_PREFIX_ALL, "same"));
+var_dump ( extract($mixed_array[7], EXTR_PREFIX_ALL, "same"));
+var_dump ( extract($mixed_array[7], EXTR_PREFIX_ALL, "diff"));
+
+/* To show variables with numerical prefixes cannot be extracted */
+$var["i"] = 1;
+$var["j"] = 2;
+$var["k"] = 3;
+echo "\n*** Testing for Numerical prefixes ***\n";
+var_dump(extract($var));
+
+
+$var1["m"] = 1;
+$var1[2] = 2;
+$var1[] = 3;
+var_dump ( extract($var1));
+
+
+/* Using Class and objects */
+
+echo "\n*** Testing for object ***\n";
+class classA
+{
+ public $v;
+}
+
+$A = new classA();
+var_dump ( extract(get_object_vars($A),EXTR_REFS));
+
+echo "\nDone";
+?>
+
+--EXPECTF--
+*** Testing Error Conditions ***
+
+Warning: Wrong parameter count for extract() in %s on line %d
+NULL
+
+Warning: extract(): Unknown extract type in %s on line %d
+NULL
+
+Warning: extract(): Unknown extract type in %s on line %d
+NULL
+
+Warning: extract(): First argument should be an array in %s on line %d
+NULL
+
+Warning: extract(): First argument should be an array in %s on line %d
+NULL
+
+Warning: Wrong parameter count for extract() in %s on line %d
+NULL
+
+Warning: extract(): Prefix expected to be specified in %s on line %d
+NULL
+
+-- Iteration 0 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+int(0)
+
+-- Iteration 1 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(9)
+int(0)
+int(9)
+int(9)
+int(0)
+
+-- Iteration 2 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 3 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(8)
+int(0)
+int(8)
+int(8)
+int(0)
+
+-- Iteration 4 --
+int(5)
+int(5)
+int(0)
+int(5)
+int(5)
+int(5)
+int(5)
+int(5)
+int(5)
+
+-- Iteration 5 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 6 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(5)
+int(0)
+int(5)
+int(5)
+int(0)
+
+-- Iteration 7 --
+int(4)
+int(4)
+int(0)
+int(4)
+int(12)
+int(4)
+int(11)
+int(11)
+int(4)
+
+-- Iteration 8 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(4)
+int(0)
+int(4)
+int(4)
+int(0)
+
+-- Iteration 9 --
+int(0)
+int(0)
+int(0)
+int(0)
+int(3)
+int(0)
+int(3)
+int(3)
+int(0)
+
+-- Iteration 10 --
+int(2)
+int(2)
+int(0)
+int(2)
+int(8)
+int(2)
+int(8)
+int(8)
+int(2)
+int(1)
+int(1)
+
+*** Testing for EXTR_PREFIX_ALL called twice with same prefix string ***
+int(5)
+int(11)
+int(11)
+
+*** Testing for Numerical prefixes ***
+int(3)
+int(1)
+
+*** Testing for object ***
+int(1)
+
+Done
diff --git a/ext/standard/tests/array/max.phpt b/ext/standard/tests/array/max.phpt
index 7edcab755..1495a78dc 100644
--- a/ext/standard/tests/array/max.phpt
+++ b/ext/standard/tests/array/max.phpt
@@ -1,5 +1,7 @@
--TEST--
max() tests
+--INI--
+precision=14
--FILE--
<?php
diff --git a/ext/standard/tests/array/min.phpt b/ext/standard/tests/array/min.phpt
index 70e3555f1..dfb3c9bde 100644
--- a/ext/standard/tests/array/min.phpt
+++ b/ext/standard/tests/array/min.phpt
@@ -1,5 +1,7 @@
--TEST--
min() tests
+--INI--
+precision=14
--FILE--
<?php
diff --git a/ext/standard/tests/array/range.phpt b/ext/standard/tests/array/range.phpt
index 23fb985f8..3ecdeff6b 100644
--- a/ext/standard/tests/array/range.phpt
+++ b/ext/standard/tests/array/range.phpt
@@ -1,33 +1,121 @@
--TEST--
-range()
+Test range() function
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
--FILE--
<?php
- var_dump(range(1, 100));
- var_dump(range(100, 1));
-
- var_dump(range("1", "100"));
- var_dump(range("100", "1"));
-
- var_dump(range("a", "z"));
- var_dump(range("z", "a"));
- var_dump(range("q", "q"));
-
- var_dump(range(5, 5));
-
- var_dump(range(5.1, 10.1));
- var_dump(range(10.1, 5.1));
-
- var_dump(range("5.1", "10.1"));
- var_dump(range("10.1", "5.1"));
-
- var_dump(range(1, 5, 0.1));
- var_dump(range(5, 1, 0.1));
-
- var_dump(range(1, 5, "0.1"));
- var_dump(range("1", "5", 0.1));
+/* Prototype: array range ( mixed $low, mixed $high [, number $step] );
+ Description: Create an array containing a range of elements
+*/
+
+echo "*** Testing range() function on basic operations ***\n";
+
+echo "\n-- Integers as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range(1, 10) );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range(10, 1) );
+
+echo "\n-- Numeric Strings as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("1", "10") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("10", "1") );
+
+echo "\n-- Chars as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("a", "z") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("z", "a") );
+
+echo "\n-- Low and High are equal --\n";
+var_dump( range(5, 5) );
+var_dump( range("q", "q") );
+
+echo "\n-- floats as Low and High --\n";
+var_dump( range(5.1, 10.1) );
+var_dump( range(10.1, 5.1) );
+
+var_dump( range("5.1", "10.1") );
+var_dump( range("10.1", "5.1") );
+
+echo "\n-- Passing step with Low and High --\n";
+var_dump( range(1, 2, 0.1) );
+var_dump( range(2, 1, 0.1) );
+
+var_dump( range(1, 2, "0.1") );
+var_dump( range("1", "2", 0.1) );
+
+echo "\n-- Testing basic string with step --\n";
+var_dump( range("abcd", "mnop", 2) );
+
+echo "\n*** Testing range() with various low and high values ***";
+$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+
+for( $i = 0; $i < count($low_arr); $i++) {
+ for( $j = 0; $j < count($high_arr); $j++) {
+ echo "\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
+ var_dump( range( $low_arr[$i], $high_arr[$j] ) );
+ }
+}
+
+
+echo "\n*** Possible variatins with steps ***\n";
+var_dump( range( 1, 5, TRUE ) );
+var_dump( range( 1, 5, array(1, 2) ) );
+
+echo "\n*** Testing max/outof range values ***\n";
+/*var_dump( range("a", "z", 255) );
+var_dump( range("z", "a", 255) ); */
+var_dump( range(2147483645, 2147483646) );
+var_dump( range(2147483646, 2147483648) );
+var_dump( range(-2147483647, -2147483646) );
+var_dump( range(-2147483648, -2147483647) );
+var_dump( range(-2147483649, -2147483647) );
+
+echo "\n*** Testing error conditions ***\n";
+
+echo "\n-- Testing ( (low < high) && (step = 0) ) --";
+var_dump( range(1, 2, 0) );
+var_dump( range("a", "b", 0) );
+
+echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
+var_dump( range(2, 1, 0) );
+var_dump( range("b", "a", 0) );
+
+echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
+var_dump( range(1.0, 7.0, 6.5) );
+
+echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
+var_dump( range(7.0, 1.0, 6.5) );
+
+echo "\n-- Testing Invalid number of arguments --";
+var_dump( range() ); // No.of args = 0
+var_dump( range(1) ); // No.of args < expected
+var_dump( range(1,2,3,4) ); // No.of args > expected
+var_dump( range(-1, -2, 2) );
+var_dump( range("a", "j", "z") );
+
+echo "\n-- Testing Invalid steps --";
+$step_arr = array( "string", NULL, FALSE, "", "\0" );
+
+foreach( $step_arr as $step ) {
+ var_dump( range( 1, 5, $step ) );
+}
+
+echo "\nDone";
?>
---EXPECT--
-array(100) {
+--EXPECTF--
+*** Testing range() function on basic operations ***
+
+-- Integers as Low and High --
+-- An array of elements from low to high --
+array(10) {
[0]=>
int(1)
[1]=>
@@ -48,390 +136,35 @@ array(100) {
int(9)
[9]=>
int(10)
- [10]=>
- int(11)
- [11]=>
- int(12)
- [12]=>
- int(13)
- [13]=>
- int(14)
- [14]=>
- int(15)
- [15]=>
- int(16)
- [16]=>
- int(17)
- [17]=>
- int(18)
- [18]=>
- int(19)
- [19]=>
- int(20)
- [20]=>
- int(21)
- [21]=>
- int(22)
- [22]=>
- int(23)
- [23]=>
- int(24)
- [24]=>
- int(25)
- [25]=>
- int(26)
- [26]=>
- int(27)
- [27]=>
- int(28)
- [28]=>
- int(29)
- [29]=>
- int(30)
- [30]=>
- int(31)
- [31]=>
- int(32)
- [32]=>
- int(33)
- [33]=>
- int(34)
- [34]=>
- int(35)
- [35]=>
- int(36)
- [36]=>
- int(37)
- [37]=>
- int(38)
- [38]=>
- int(39)
- [39]=>
- int(40)
- [40]=>
- int(41)
- [41]=>
- int(42)
- [42]=>
- int(43)
- [43]=>
- int(44)
- [44]=>
- int(45)
- [45]=>
- int(46)
- [46]=>
- int(47)
- [47]=>
- int(48)
- [48]=>
- int(49)
- [49]=>
- int(50)
- [50]=>
- int(51)
- [51]=>
- int(52)
- [52]=>
- int(53)
- [53]=>
- int(54)
- [54]=>
- int(55)
- [55]=>
- int(56)
- [56]=>
- int(57)
- [57]=>
- int(58)
- [58]=>
- int(59)
- [59]=>
- int(60)
- [60]=>
- int(61)
- [61]=>
- int(62)
- [62]=>
- int(63)
- [63]=>
- int(64)
- [64]=>
- int(65)
- [65]=>
- int(66)
- [66]=>
- int(67)
- [67]=>
- int(68)
- [68]=>
- int(69)
- [69]=>
- int(70)
- [70]=>
- int(71)
- [71]=>
- int(72)
- [72]=>
- int(73)
- [73]=>
- int(74)
- [74]=>
- int(75)
- [75]=>
- int(76)
- [76]=>
- int(77)
- [77]=>
- int(78)
- [78]=>
- int(79)
- [79]=>
- int(80)
- [80]=>
- int(81)
- [81]=>
- int(82)
- [82]=>
- int(83)
- [83]=>
- int(84)
- [84]=>
- int(85)
- [85]=>
- int(86)
- [86]=>
- int(87)
- [87]=>
- int(88)
- [88]=>
- int(89)
- [89]=>
- int(90)
- [90]=>
- int(91)
- [91]=>
- int(92)
- [92]=>
- int(93)
- [93]=>
- int(94)
- [94]=>
- int(95)
- [95]=>
- int(96)
- [96]=>
- int(97)
- [97]=>
- int(98)
- [98]=>
- int(99)
- [99]=>
- int(100)
-}
-array(100) {
- [0]=>
- int(100)
- [1]=>
- int(99)
- [2]=>
- int(98)
- [3]=>
- int(97)
- [4]=>
- int(96)
- [5]=>
- int(95)
- [6]=>
- int(94)
- [7]=>
- int(93)
- [8]=>
- int(92)
- [9]=>
- int(91)
- [10]=>
- int(90)
- [11]=>
- int(89)
- [12]=>
- int(88)
- [13]=>
- int(87)
- [14]=>
- int(86)
- [15]=>
- int(85)
- [16]=>
- int(84)
- [17]=>
- int(83)
- [18]=>
- int(82)
- [19]=>
- int(81)
- [20]=>
- int(80)
- [21]=>
- int(79)
- [22]=>
- int(78)
- [23]=>
- int(77)
- [24]=>
- int(76)
- [25]=>
- int(75)
- [26]=>
- int(74)
- [27]=>
- int(73)
- [28]=>
- int(72)
- [29]=>
- int(71)
- [30]=>
- int(70)
- [31]=>
- int(69)
- [32]=>
- int(68)
- [33]=>
- int(67)
- [34]=>
- int(66)
- [35]=>
- int(65)
- [36]=>
- int(64)
- [37]=>
- int(63)
- [38]=>
- int(62)
- [39]=>
- int(61)
- [40]=>
- int(60)
- [41]=>
- int(59)
- [42]=>
- int(58)
- [43]=>
- int(57)
- [44]=>
- int(56)
- [45]=>
- int(55)
- [46]=>
- int(54)
- [47]=>
- int(53)
- [48]=>
- int(52)
- [49]=>
- int(51)
- [50]=>
- int(50)
- [51]=>
- int(49)
- [52]=>
- int(48)
- [53]=>
- int(47)
- [54]=>
- int(46)
- [55]=>
- int(45)
- [56]=>
- int(44)
- [57]=>
- int(43)
- [58]=>
- int(42)
- [59]=>
- int(41)
- [60]=>
- int(40)
- [61]=>
- int(39)
- [62]=>
- int(38)
- [63]=>
- int(37)
- [64]=>
- int(36)
- [65]=>
- int(35)
- [66]=>
- int(34)
- [67]=>
- int(33)
- [68]=>
- int(32)
- [69]=>
- int(31)
- [70]=>
- int(30)
- [71]=>
- int(29)
- [72]=>
- int(28)
- [73]=>
- int(27)
- [74]=>
- int(26)
- [75]=>
- int(25)
- [76]=>
- int(24)
- [77]=>
- int(23)
- [78]=>
- int(22)
- [79]=>
- int(21)
- [80]=>
- int(20)
- [81]=>
- int(19)
- [82]=>
- int(18)
- [83]=>
- int(17)
- [84]=>
- int(16)
- [85]=>
- int(15)
- [86]=>
- int(14)
- [87]=>
- int(13)
- [88]=>
- int(12)
- [89]=>
- int(11)
- [90]=>
+}
+
+-- An array of elements from high to low --
+array(10) {
+ [0]=>
int(10)
- [91]=>
+ [1]=>
int(9)
- [92]=>
+ [2]=>
int(8)
- [93]=>
+ [3]=>
int(7)
- [94]=>
+ [4]=>
int(6)
- [95]=>
+ [5]=>
int(5)
- [96]=>
+ [6]=>
int(4)
- [97]=>
+ [7]=>
int(3)
- [98]=>
+ [8]=>
int(2)
- [99]=>
+ [9]=>
int(1)
}
-array(100) {
+
+-- Numeric Strings as Low and High --
+-- An array of elements from low to high --
+array(10) {
[0]=>
int(1)
[1]=>
@@ -452,389 +185,34 @@ array(100) {
int(9)
[9]=>
int(10)
- [10]=>
- int(11)
- [11]=>
- int(12)
- [12]=>
- int(13)
- [13]=>
- int(14)
- [14]=>
- int(15)
- [15]=>
- int(16)
- [16]=>
- int(17)
- [17]=>
- int(18)
- [18]=>
- int(19)
- [19]=>
- int(20)
- [20]=>
- int(21)
- [21]=>
- int(22)
- [22]=>
- int(23)
- [23]=>
- int(24)
- [24]=>
- int(25)
- [25]=>
- int(26)
- [26]=>
- int(27)
- [27]=>
- int(28)
- [28]=>
- int(29)
- [29]=>
- int(30)
- [30]=>
- int(31)
- [31]=>
- int(32)
- [32]=>
- int(33)
- [33]=>
- int(34)
- [34]=>
- int(35)
- [35]=>
- int(36)
- [36]=>
- int(37)
- [37]=>
- int(38)
- [38]=>
- int(39)
- [39]=>
- int(40)
- [40]=>
- int(41)
- [41]=>
- int(42)
- [42]=>
- int(43)
- [43]=>
- int(44)
- [44]=>
- int(45)
- [45]=>
- int(46)
- [46]=>
- int(47)
- [47]=>
- int(48)
- [48]=>
- int(49)
- [49]=>
- int(50)
- [50]=>
- int(51)
- [51]=>
- int(52)
- [52]=>
- int(53)
- [53]=>
- int(54)
- [54]=>
- int(55)
- [55]=>
- int(56)
- [56]=>
- int(57)
- [57]=>
- int(58)
- [58]=>
- int(59)
- [59]=>
- int(60)
- [60]=>
- int(61)
- [61]=>
- int(62)
- [62]=>
- int(63)
- [63]=>
- int(64)
- [64]=>
- int(65)
- [65]=>
- int(66)
- [66]=>
- int(67)
- [67]=>
- int(68)
- [68]=>
- int(69)
- [69]=>
- int(70)
- [70]=>
- int(71)
- [71]=>
- int(72)
- [72]=>
- int(73)
- [73]=>
- int(74)
- [74]=>
- int(75)
- [75]=>
- int(76)
- [76]=>
- int(77)
- [77]=>
- int(78)
- [78]=>
- int(79)
- [79]=>
- int(80)
- [80]=>
- int(81)
- [81]=>
- int(82)
- [82]=>
- int(83)
- [83]=>
- int(84)
- [84]=>
- int(85)
- [85]=>
- int(86)
- [86]=>
- int(87)
- [87]=>
- int(88)
- [88]=>
- int(89)
- [89]=>
- int(90)
- [90]=>
- int(91)
- [91]=>
- int(92)
- [92]=>
- int(93)
- [93]=>
- int(94)
- [94]=>
- int(95)
- [95]=>
- int(96)
- [96]=>
- int(97)
- [97]=>
- int(98)
- [98]=>
- int(99)
- [99]=>
- int(100)
-}
-array(100) {
- [0]=>
- int(100)
- [1]=>
- int(99)
- [2]=>
- int(98)
- [3]=>
- int(97)
- [4]=>
- int(96)
- [5]=>
- int(95)
- [6]=>
- int(94)
- [7]=>
- int(93)
- [8]=>
- int(92)
- [9]=>
- int(91)
- [10]=>
- int(90)
- [11]=>
- int(89)
- [12]=>
- int(88)
- [13]=>
- int(87)
- [14]=>
- int(86)
- [15]=>
- int(85)
- [16]=>
- int(84)
- [17]=>
- int(83)
- [18]=>
- int(82)
- [19]=>
- int(81)
- [20]=>
- int(80)
- [21]=>
- int(79)
- [22]=>
- int(78)
- [23]=>
- int(77)
- [24]=>
- int(76)
- [25]=>
- int(75)
- [26]=>
- int(74)
- [27]=>
- int(73)
- [28]=>
- int(72)
- [29]=>
- int(71)
- [30]=>
- int(70)
- [31]=>
- int(69)
- [32]=>
- int(68)
- [33]=>
- int(67)
- [34]=>
- int(66)
- [35]=>
- int(65)
- [36]=>
- int(64)
- [37]=>
- int(63)
- [38]=>
- int(62)
- [39]=>
- int(61)
- [40]=>
- int(60)
- [41]=>
- int(59)
- [42]=>
- int(58)
- [43]=>
- int(57)
- [44]=>
- int(56)
- [45]=>
- int(55)
- [46]=>
- int(54)
- [47]=>
- int(53)
- [48]=>
- int(52)
- [49]=>
- int(51)
- [50]=>
- int(50)
- [51]=>
- int(49)
- [52]=>
- int(48)
- [53]=>
- int(47)
- [54]=>
- int(46)
- [55]=>
- int(45)
- [56]=>
- int(44)
- [57]=>
- int(43)
- [58]=>
- int(42)
- [59]=>
- int(41)
- [60]=>
- int(40)
- [61]=>
- int(39)
- [62]=>
- int(38)
- [63]=>
- int(37)
- [64]=>
- int(36)
- [65]=>
- int(35)
- [66]=>
- int(34)
- [67]=>
- int(33)
- [68]=>
- int(32)
- [69]=>
- int(31)
- [70]=>
- int(30)
- [71]=>
- int(29)
- [72]=>
- int(28)
- [73]=>
- int(27)
- [74]=>
- int(26)
- [75]=>
- int(25)
- [76]=>
- int(24)
- [77]=>
- int(23)
- [78]=>
- int(22)
- [79]=>
- int(21)
- [80]=>
- int(20)
- [81]=>
- int(19)
- [82]=>
- int(18)
- [83]=>
- int(17)
- [84]=>
- int(16)
- [85]=>
- int(15)
- [86]=>
- int(14)
- [87]=>
- int(13)
- [88]=>
- int(12)
- [89]=>
- int(11)
- [90]=>
+}
+
+-- An array of elements from high to low --
+array(10) {
+ [0]=>
int(10)
- [91]=>
+ [1]=>
int(9)
- [92]=>
+ [2]=>
int(8)
- [93]=>
+ [3]=>
int(7)
- [94]=>
+ [4]=>
int(6)
- [95]=>
+ [5]=>
int(5)
- [96]=>
+ [6]=>
int(4)
- [97]=>
+ [7]=>
int(3)
- [98]=>
+ [8]=>
int(2)
- [99]=>
+ [9]=>
int(1)
}
+
+-- Chars as Low and High --
+-- An array of elements from low to high --
array(26) {
[0]=>
string(1) "a"
@@ -889,6 +267,8 @@ array(26) {
[25]=>
string(1) "z"
}
+
+-- An array of elements from high to low --
array(26) {
[0]=>
string(1) "z"
@@ -943,14 +323,18 @@ array(26) {
[25]=>
string(1) "a"
}
+
+-- Low and High are equal --
array(1) {
[0]=>
- string(1) "q"
+ int(5)
}
array(1) {
[0]=>
- int(5)
+ string(1) "q"
}
+
+-- floats as Low and High --
array(6) {
[0]=>
float(5.1)
@@ -1007,7 +391,9 @@ array(6) {
[5]=>
float(5.1)
}
-array(41) {
+
+-- Passing step with Low and High --
+array(11) {
[0]=>
float(1)
[1]=>
@@ -1030,152 +416,32 @@ array(41) {
float(1.9)
[10]=>
float(2)
- [11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
-}
-array(41) {
- [0]=>
- float(5)
- [1]=>
- float(4.9)
- [2]=>
- float(4.8)
- [3]=>
- float(4.7)
- [4]=>
- float(4.6)
- [5]=>
- float(4.5)
- [6]=>
- float(4.4)
- [7]=>
- float(4.3)
- [8]=>
- float(4.2)
- [9]=>
- float(4.1)
- [10]=>
- float(4)
- [11]=>
- float(3.9)
- [12]=>
- float(3.8)
- [13]=>
- float(3.7)
- [14]=>
- float(3.6)
- [15]=>
- float(3.5)
- [16]=>
- float(3.4)
- [17]=>
- float(3.3)
- [18]=>
- float(3.2)
- [19]=>
- float(3.1)
- [20]=>
- float(3)
- [21]=>
- float(2.9)
- [22]=>
- float(2.8)
- [23]=>
- float(2.7)
- [24]=>
- float(2.6)
- [25]=>
- float(2.5)
- [26]=>
- float(2.4)
- [27]=>
- float(2.3)
- [28]=>
- float(2.2)
- [29]=>
- float(2.1)
- [30]=>
+}
+array(11) {
+ [0]=>
float(2)
- [31]=>
+ [1]=>
float(1.9)
- [32]=>
+ [2]=>
float(1.8)
- [33]=>
+ [3]=>
float(1.7)
- [34]=>
+ [4]=>
float(1.6)
- [35]=>
+ [5]=>
float(1.5)
- [36]=>
+ [6]=>
float(1.4)
- [37]=>
+ [7]=>
float(1.3)
- [38]=>
+ [8]=>
float(1.2)
- [39]=>
+ [9]=>
float(1.1)
- [40]=>
+ [10]=>
float(1)
}
-array(41) {
+array(11) {
[0]=>
float(1)
[1]=>
@@ -1198,68 +464,8 @@ array(41) {
float(1.9)
[10]=>
float(2)
- [11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
-}
-array(41) {
+}
+array(11) {
[0]=>
float(1)
[1]=>
@@ -1282,64 +488,720 @@ array(41) {
float(1.9)
[10]=>
float(2)
+}
+
+-- Testing basic string with step --
+array(7) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "c"
+ [2]=>
+ string(1) "e"
+ [3]=>
+ string(1) "g"
+ [4]=>
+ string(1) "i"
+ [5]=>
+ string(1) "k"
+ [6]=>
+ string(1) "m"
+}
+
+*** Testing range() with various low and high values ***
+-- creating an array with low = 'ABCD' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+
+-- creating an array with low = 'ABCD' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = 'ABCD' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '-10.5555' and high = 'ABCD' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '-10.5555' --
+array(1) {
+ [0]=>
+ float(-10.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '1' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
[11]=>
- float(2.1)
- [12]=>
- float(2.2)
- [13]=>
- float(2.3)
- [14]=>
- float(2.4)
- [15]=>
- float(2.5)
- [16]=>
- float(2.6)
- [17]=>
- float(2.7)
- [18]=>
- float(2.8)
- [19]=>
- float(2.9)
- [20]=>
- float(3)
- [21]=>
- float(3.1)
- [22]=>
- float(3.2)
- [23]=>
- float(3.3)
- [24]=>
- float(3.4)
- [25]=>
- float(3.5)
- [26]=>
- float(3.6)
- [27]=>
- float(3.7)
- [28]=>
- float(3.8)
- [29]=>
- float(3.9)
- [30]=>
- float(4)
- [31]=>
- float(4.1)
- [32]=>
- float(4.2)
- [33]=>
- float(4.3)
- [34]=>
- float(4.4)
- [35]=>
- float(4.5)
- [36]=>
- float(4.6)
- [37]=>
- float(4.7)
- [38]=>
- float(4.8)
- [39]=>
- float(4.9)
- [40]=>
- float(5)
+ float(0.4445)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = 'Array' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+ [11]=>
+ float(0.4445)
+}
+
+-- creating an array with low = '1' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = '1' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = 'Array' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Possible variatins with steps ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+
+*** Testing max/outof range values ***
+array(2) {
+ [0]=>
+ int(2147483645)
+ [1]=>
+ int(2147483646)
+}
+array(3) {
+ [0]=>
+ float(2147483646)
+ [1]=>
+ float(2147483647)
+ [2]=>
+ float(2147483648)
+}
+array(2) {
+ [0]=>
+ int(-2147483647)
+ [1]=>
+ int(-2147483646)
+}
+array(2) {
+ [0]=>
+ float(-2147483648)
+ [1]=>
+ float(-2147483647)
+}
+array(3) {
+ [0]=>
+ float(-2147483649)
+ [1]=>
+ float(-2147483648)
+ [2]=>
+ float(-2147483647)
}
+
+*** Testing error conditions ***
+
+-- Testing ( (low < high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low < high) && (high-low < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (low-high < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid number of arguments --
+Warning: range() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: range() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: range() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid steps --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Done
diff --git a/ext/standard/tests/array/range_64bit.phpt b/ext/standard/tests/array/range_64bit.phpt
new file mode 100644
index 000000000..2f348afab
--- /dev/null
+++ b/ext/standard/tests/array/range_64bit.phpt
@@ -0,0 +1,1207 @@
+--TEST--
+Test range() function
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype: array range ( mixed $low, mixed $high [, number $step] );
+ Description: Create an array containing a range of elements
+*/
+
+echo "*** Testing range() function on basic operations ***\n";
+
+echo "\n-- Integers as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range(1, 10) );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range(10, 1) );
+
+echo "\n-- Numeric Strings as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("1", "10") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("10", "1") );
+
+echo "\n-- Chars as Low and High --\n";
+echo "-- An array of elements from low to high --\n";
+var_dump( range("a", "z") );
+echo "\n-- An array of elements from high to low --\n";
+var_dump( range("z", "a") );
+
+echo "\n-- Low and High are equal --\n";
+var_dump( range(5, 5) );
+var_dump( range("q", "q") );
+
+echo "\n-- floats as Low and High --\n";
+var_dump( range(5.1, 10.1) );
+var_dump( range(10.1, 5.1) );
+
+var_dump( range("5.1", "10.1") );
+var_dump( range("10.1", "5.1") );
+
+echo "\n-- Passing step with Low and High --\n";
+var_dump( range(1, 2, 0.1) );
+var_dump( range(2, 1, 0.1) );
+
+var_dump( range(1, 2, "0.1") );
+var_dump( range("1", "2", 0.1) );
+
+echo "\n-- Testing basic string with step --\n";
+var_dump( range("abcd", "mnop", 2) );
+
+echo "\n*** Testing range() with various low and high values ***";
+$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
+
+for( $i = 0; $i < count($low_arr); $i++) {
+ for( $j = 0; $j < count($high_arr); $j++) {
+ echo "\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
+ var_dump( range( $low_arr[$i], $high_arr[$j] ) );
+ }
+}
+
+
+echo "\n*** Possible variatins with steps ***\n";
+var_dump( range( 1, 5, TRUE ) );
+var_dump( range( 1, 5, array(1, 2) ) );
+
+echo "\n*** Testing max/outof range values ***\n";
+/*var_dump( range("a", "z", 255) );
+var_dump( range("z", "a", 255) ); */
+var_dump( range(2147483645, 2147483646) );
+var_dump( range(2147483646, 2147483648) );
+var_dump( range(-2147483647, -2147483646) );
+var_dump( range(-2147483648, -2147483647) );
+var_dump( range(-2147483649, -2147483647) );
+
+echo "\n*** Testing error conditions ***\n";
+
+echo "\n-- Testing ( (low < high) && (step = 0) ) --";
+var_dump( range(1, 2, 0) );
+var_dump( range("a", "b", 0) );
+
+echo "\n\n-- Testing ( (low > high) && (step = 0) ) --";
+var_dump( range(2, 1, 0) );
+var_dump( range("b", "a", 0) );
+
+echo "\n\n-- Testing ( (low < high) && (high-low < step) ) --";
+var_dump( range(1.0, 7.0, 6.5) );
+
+echo "\n\n-- Testing ( (low > high) && (low-high < step) ) --";
+var_dump( range(7.0, 1.0, 6.5) );
+
+echo "\n-- Testing Invalid number of arguments --";
+var_dump( range() ); // No.of args = 0
+var_dump( range(1) ); // No.of args < expected
+var_dump( range(1,2,3,4) ); // No.of args > expected
+var_dump( range(-1, -2, 2) );
+var_dump( range("a", "j", "z") );
+
+echo "\n-- Testing Invalid steps --";
+$step_arr = array( "string", NULL, FALSE, "", "\0" );
+
+foreach( $step_arr as $step ) {
+ var_dump( range( 1, 5, $step ) );
+}
+
+echo "\nDone";
+?>
+--EXPECTF--
+*** Testing range() function on basic operations ***
+
+-- Integers as Low and High --
+-- An array of elements from low to high --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+
+-- An array of elements from high to low --
+array(10) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(9)
+ [2]=>
+ int(8)
+ [3]=>
+ int(7)
+ [4]=>
+ int(6)
+ [5]=>
+ int(5)
+ [6]=>
+ int(4)
+ [7]=>
+ int(3)
+ [8]=>
+ int(2)
+ [9]=>
+ int(1)
+}
+
+-- Numeric Strings as Low and High --
+-- An array of elements from low to high --
+array(10) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ [7]=>
+ int(8)
+ [8]=>
+ int(9)
+ [9]=>
+ int(10)
+}
+
+-- An array of elements from high to low --
+array(10) {
+ [0]=>
+ int(10)
+ [1]=>
+ int(9)
+ [2]=>
+ int(8)
+ [3]=>
+ int(7)
+ [4]=>
+ int(6)
+ [5]=>
+ int(5)
+ [6]=>
+ int(4)
+ [7]=>
+ int(3)
+ [8]=>
+ int(2)
+ [9]=>
+ int(1)
+}
+
+-- Chars as Low and High --
+-- An array of elements from low to high --
+array(26) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+ [3]=>
+ string(1) "d"
+ [4]=>
+ string(1) "e"
+ [5]=>
+ string(1) "f"
+ [6]=>
+ string(1) "g"
+ [7]=>
+ string(1) "h"
+ [8]=>
+ string(1) "i"
+ [9]=>
+ string(1) "j"
+ [10]=>
+ string(1) "k"
+ [11]=>
+ string(1) "l"
+ [12]=>
+ string(1) "m"
+ [13]=>
+ string(1) "n"
+ [14]=>
+ string(1) "o"
+ [15]=>
+ string(1) "p"
+ [16]=>
+ string(1) "q"
+ [17]=>
+ string(1) "r"
+ [18]=>
+ string(1) "s"
+ [19]=>
+ string(1) "t"
+ [20]=>
+ string(1) "u"
+ [21]=>
+ string(1) "v"
+ [22]=>
+ string(1) "w"
+ [23]=>
+ string(1) "x"
+ [24]=>
+ string(1) "y"
+ [25]=>
+ string(1) "z"
+}
+
+-- An array of elements from high to low --
+array(26) {
+ [0]=>
+ string(1) "z"
+ [1]=>
+ string(1) "y"
+ [2]=>
+ string(1) "x"
+ [3]=>
+ string(1) "w"
+ [4]=>
+ string(1) "v"
+ [5]=>
+ string(1) "u"
+ [6]=>
+ string(1) "t"
+ [7]=>
+ string(1) "s"
+ [8]=>
+ string(1) "r"
+ [9]=>
+ string(1) "q"
+ [10]=>
+ string(1) "p"
+ [11]=>
+ string(1) "o"
+ [12]=>
+ string(1) "n"
+ [13]=>
+ string(1) "m"
+ [14]=>
+ string(1) "l"
+ [15]=>
+ string(1) "k"
+ [16]=>
+ string(1) "j"
+ [17]=>
+ string(1) "i"
+ [18]=>
+ string(1) "h"
+ [19]=>
+ string(1) "g"
+ [20]=>
+ string(1) "f"
+ [21]=>
+ string(1) "e"
+ [22]=>
+ string(1) "d"
+ [23]=>
+ string(1) "c"
+ [24]=>
+ string(1) "b"
+ [25]=>
+ string(1) "a"
+}
+
+-- Low and High are equal --
+array(1) {
+ [0]=>
+ int(5)
+}
+array(1) {
+ [0]=>
+ string(1) "q"
+}
+
+-- floats as Low and High --
+array(6) {
+ [0]=>
+ float(5.1)
+ [1]=>
+ float(6.1)
+ [2]=>
+ float(7.1)
+ [3]=>
+ float(8.1)
+ [4]=>
+ float(9.1)
+ [5]=>
+ float(10.1)
+}
+array(6) {
+ [0]=>
+ float(10.1)
+ [1]=>
+ float(9.1)
+ [2]=>
+ float(8.1)
+ [3]=>
+ float(7.1)
+ [4]=>
+ float(6.1)
+ [5]=>
+ float(5.1)
+}
+array(6) {
+ [0]=>
+ float(5.1)
+ [1]=>
+ float(6.1)
+ [2]=>
+ float(7.1)
+ [3]=>
+ float(8.1)
+ [4]=>
+ float(9.1)
+ [5]=>
+ float(10.1)
+}
+array(6) {
+ [0]=>
+ float(10.1)
+ [1]=>
+ float(9.1)
+ [2]=>
+ float(8.1)
+ [3]=>
+ float(7.1)
+ [4]=>
+ float(6.1)
+ [5]=>
+ float(5.1)
+}
+
+-- Passing step with Low and High --
+array(11) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(1.1)
+ [2]=>
+ float(1.2)
+ [3]=>
+ float(1.3)
+ [4]=>
+ float(1.4)
+ [5]=>
+ float(1.5)
+ [6]=>
+ float(1.6)
+ [7]=>
+ float(1.7)
+ [8]=>
+ float(1.8)
+ [9]=>
+ float(1.9)
+ [10]=>
+ float(2)
+}
+array(11) {
+ [0]=>
+ float(2)
+ [1]=>
+ float(1.9)
+ [2]=>
+ float(1.8)
+ [3]=>
+ float(1.7)
+ [4]=>
+ float(1.6)
+ [5]=>
+ float(1.5)
+ [6]=>
+ float(1.4)
+ [7]=>
+ float(1.3)
+ [8]=>
+ float(1.2)
+ [9]=>
+ float(1.1)
+ [10]=>
+ float(1)
+}
+array(11) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(1.1)
+ [2]=>
+ float(1.2)
+ [3]=>
+ float(1.3)
+ [4]=>
+ float(1.4)
+ [5]=>
+ float(1.5)
+ [6]=>
+ float(1.6)
+ [7]=>
+ float(1.7)
+ [8]=>
+ float(1.8)
+ [9]=>
+ float(1.9)
+ [10]=>
+ float(2)
+}
+array(11) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(1.1)
+ [2]=>
+ float(1.2)
+ [3]=>
+ float(1.3)
+ [4]=>
+ float(1.4)
+ [5]=>
+ float(1.5)
+ [6]=>
+ float(1.6)
+ [7]=>
+ float(1.7)
+ [8]=>
+ float(1.8)
+ [9]=>
+ float(1.9)
+ [10]=>
+ float(2)
+}
+
+-- Testing basic string with step --
+array(7) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "c"
+ [2]=>
+ string(1) "e"
+ [3]=>
+ string(1) "g"
+ [4]=>
+ string(1) "i"
+ [5]=>
+ string(1) "k"
+ [6]=>
+ string(1) "m"
+}
+
+*** Testing range() with various low and high values ***
+-- creating an array with low = 'ABCD' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ string(1) "A"
+}
+
+-- creating an array with low = 'ABCD' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = 'ABCD' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = 'ABCD' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '-10.5555' and high = 'ABCD' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '-10.5555' --
+array(1) {
+ [0]=>
+ float(-10.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '1' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+ [11]=>
+ float(0.4445)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = '' --
+array(11) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+}
+
+-- creating an array with low = '-10.5555' and high = 'Array' --
+array(12) {
+ [0]=>
+ float(-10.5555)
+ [1]=>
+ float(-9.5555)
+ [2]=>
+ float(-8.5555)
+ [3]=>
+ float(-7.5555)
+ [4]=>
+ float(-6.5555)
+ [5]=>
+ float(-5.5555)
+ [6]=>
+ float(-4.5555)
+ [7]=>
+ float(-3.5555)
+ [8]=>
+ float(-2.5555)
+ [9]=>
+ float(-1.5555)
+ [10]=>
+ float(-0.5555)
+ [11]=>
+ float(0.4445)
+}
+
+-- creating an array with low = '1' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = '1' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = '1' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = 'ABCD' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '-10.5555' --
+array(11) {
+ [0]=>
+ float(0)
+ [1]=>
+ float(-1)
+ [2]=>
+ float(-2)
+ [3]=>
+ float(-3)
+ [4]=>
+ float(-4)
+ [5]=>
+ float(-5)
+ [6]=>
+ float(-6)
+ [7]=>
+ float(-7)
+ [8]=>
+ float(-8)
+ [9]=>
+ float(-9)
+ [10]=>
+ float(-10)
+}
+
+-- creating an array with low = '' and high = '1' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = '' --
+array(1) {
+ [0]=>
+ int(0)
+}
+
+-- creating an array with low = '' and high = 'Array' --
+array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = 'ABCD' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '-10.5555' --
+array(12) {
+ [0]=>
+ float(1)
+ [1]=>
+ float(0)
+ [2]=>
+ float(-1)
+ [3]=>
+ float(-2)
+ [4]=>
+ float(-3)
+ [5]=>
+ float(-4)
+ [6]=>
+ float(-5)
+ [7]=>
+ float(-6)
+ [8]=>
+ float(-7)
+ [9]=>
+ float(-8)
+ [10]=>
+ float(-9)
+ [11]=>
+ float(-10)
+}
+
+-- creating an array with low = 'Array' and high = '1' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = '' --
+array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+}
+
+-- creating an array with low = 'Array' and high = 'Array' --
+array(1) {
+ [0]=>
+ int(1)
+}
+
+*** Possible variatins with steps ***
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+}
+
+*** Testing max/outof range values ***
+array(2) {
+ [0]=>
+ int(2147483645)
+ [1]=>
+ int(2147483646)
+}
+array(3) {
+ [0]=>
+ int(2147483646)
+ [1]=>
+ int(2147483647)
+ [2]=>
+ int(2147483648)
+}
+array(2) {
+ [0]=>
+ int(-2147483647)
+ [1]=>
+ int(-2147483646)
+}
+array(2) {
+ [0]=>
+ int(-2147483648)
+ [1]=>
+ int(-2147483647)
+}
+array(3) {
+ [0]=>
+ int(-2147483649)
+ [1]=>
+ int(-2147483648)
+ [2]=>
+ int(-2147483647)
+}
+
+*** Testing error conditions ***
+
+-- Testing ( (low < high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (step = 0) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low < high) && (high-low < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+
+-- Testing ( (low > high) && (low-high < step) ) --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid number of arguments --
+Warning: range() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+
+Warning: range() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: range() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+-- Testing Invalid steps --
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Warning: range(): step exceeds the specified range in %s on line %d
+bool(false)
+
+Done