kraghuba                Tue Nov 27 15:18:11 2007 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/standard/tests/array   array_combine_error1.phpt 
                                        array_combine_error2.phpt 
                                        array_combine_variation1.phpt 
                                        array_combine_variation2.phpt 
                                        array_combine_variation3.phpt 
                                        array_combine_variation4.phpt 
                                        array_combine_variation5.phpt 
                                        array_combine_variation6.phpt 
                                        array_combine_basic.phpt 
  Log:
  New testcases for array_combine() function
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_error1.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_error1.phpt
+++ php-src/ext/standard/tests/array/array_combine_error1.phpt
--TEST--
Test array_combine() function : error conditions 
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys 
 *              and the elements of the second as the corresponding values 
 * Source code: ext/standard/array.c
*/

echo "*** Testing array_combine() : error conditions ***\n";

// Zero arguments
echo "\n-- Testing array_combine() function with Zero arguments --\n";
var_dump( array_combine() );

//Test array_combine with one more than the expected number of arguments
echo "\n-- Testing array_combine() function with more than expected no. of 
arguments --\n";
$keys = array(1, 2);
$values = array(1, 2);
$extra_arg = 10;
var_dump( array_combine($keys,$values, $extra_arg) );

// Testing array_combine with one less than the expected number of arguments
echo "\n-- Testing array_combine() function with less than expected no. of 
arguments --\n";
$keys = array(1, 2);
var_dump( array_combine($keys) );

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : error conditions ***

-- Testing array_combine() function with Zero arguments --

Warning: array_combine() expects exactly 2 parameters, 0 given in %s on line %d
NULL

-- Testing array_combine() function with more than expected no. of arguments --

Warning: array_combine() expects exactly 2 parameters, 3 given in %s on line %d
NULL

-- Testing array_combine() function with less than expected no. of arguments --

Warning: array_combine() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Done
--UEXPECTF--
*** Testing array_combine() : error conditions ***

-- Testing array_combine() function with Zero arguments --

Warning: array_combine() expects exactly 2 parameters, 0 given in %s on line %d
NULL

-- Testing array_combine() function with more than expected no. of arguments --

Warning: array_combine() expects exactly 2 parameters, 3 given in %s on line %d
NULL

-- Testing array_combine() function with less than expected no. of arguments --

Warning: array_combine() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_error2.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_error2.phpt
+++ php-src/ext/standard/tests/array/array_combine_error2.phpt
--TEST--
Test array_combine() function : error conditions - empty array
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys 
 *              and the elements of the second as the corresponding values 
 * Source code: ext/standard/array.c
*/

echo "*** Testing array_combine() : error conditions specific to 
array_combine() ***\n";

// Testing array_combine by passing empty arrays to $keys and $values arguments
echo "\n-- Testing array_combine() function with empty arrays --\n";
var_dump( array_combine(array(), array()) );

// Testing array_combine by passing empty array to $keys
echo "\n-- Testing array_combine() function with empty array for \$keys 
argument --\n";
var_dump( array_combine(array(), array(1, 2)) );

// Testing array_combine by passing empty array to $values
echo "\n-- Testing array_combine() function with empty array for \$values 
argument --\n";
var_dump( array_combine(array(1, 2), array()) );

// Testing array_combine with arrays having unequal number of elements
echo "\n-- Testing array_combine() function by passing array with unequal 
number of elements --\n";
var_dump( array_combine(array(1, 2), array(1, 2, 3)) );

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : error conditions specific to array_combine() ***

-- Testing array_combine() function with empty arrays --

Warning: array_combine(): Both parameters should have at least 1 element in %s 
on line %d
bool(false)

-- Testing array_combine() function with empty array for $keys argument --

Warning: array_combine(): Both parameters should have an equal number of 
elements in %s on line %d
bool(false)

-- Testing array_combine() function with empty array for $values argument --

Warning: array_combine(): Both parameters should have an equal number of 
elements in %s on line %d
bool(false)

-- Testing array_combine() function by passing array with unequal number of 
elements --

Warning: array_combine(): Both parameters should have an equal number of 
elements in %s on line %d
bool(false)
Done
--UEXPECTF--
*** Testing array_combine() : error conditions specific to array_combine() ***

-- Testing array_combine() function with empty arrays --

Warning: array_combine(): Both parameters should have at least 1 element in %s 
on line %d
bool(false)

-- Testing array_combine() function with empty array for $keys argument --

Warning: array_combine(): Both parameters should have an equal number of 
elements in %s on line %d
bool(false)

-- Testing array_combine() function with empty array for $values argument --

Warning: array_combine(): Both parameters should have an equal number of 
elements in %s on line %d
bool(false)

-- Testing array_combine() function by passing array with unequal number of 
elements --

Warning: array_combine(): Both parameters should have an equal number of 
elements in %s on line %d
bool(false)
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_variation1.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_variation1.phpt
+++ php-src/ext/standard/tests/array/array_combine_variation1.phpt
--TEST--
Test array_combine() function : usage variations - unexpected values for 'keys' 
argument
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys 
 *              and the elements of the second as the corresponding values 
 * Source code: ext/standard/array.c
*/

/*
* Testing array_combine() function by passing values to $keys argument other 
than arrays
* and see that function emits proper warning messages wherever expected.
* The $values argument passed is a fixed array.
*/

echo "*** Testing array_combine() : Passing non-array values to \$keys argument 
***\n";

// Initialise $values argument 
$values = array(1, 2);

//get an unset variable
$unset_var = 10;
unset($unset_var);

// get a class
class classA
{
  public function __toString() {
    return "Class A object";
  }
}

// heredoc string
$heredoc = <<<EOT
hello world
EOT;

// get a resource variable
$fp = fopen(__FILE__, "r");

// unexpected values to be passed to $keys argument
$keys_passed = array(

       // int data
/*1*/  0,
       1,
       12345,
       -2345,

       // float data
/*5*/  10.5,
       -10.5,
       12.3456789000e10,
       12.3456789000E-10,
       .5,

       // null data
/*10*/ NULL,
       null,

       // boolean data
/*12*/ true,
       false,
       TRUE,
      FALSE,

       // empty data
/*16*/ "",
       '',

       // string data
/*18*/ "string",
       'string',
       $heredoc,

       // object data
/*21*/ new classA(),

       // undefined data
/*22*/ @$undefined_var,

       // unset data
/*23*/ @$unset_var,

       // resource variable
/*24*/ $fp
);

// loop through each element within $keys_passed to check the behavior of 
array_combine()
$iterator = 1;
foreach($keys_passed as $keys) {
  echo "-- Iteration $iterator --\n";
  var_dump( array_combine($keys,$values) );
  $iterator++;
};

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : Passing non-array values to $keys argument ***
-- Iteration 1 --

Warning: array_combine() expects parameter 1 to be array, integer given in %s 
on line %d
NULL
-- Iteration 2 --

Warning: array_combine() expects parameter 1 to be array, integer given in %s 
on line %d
NULL
-- Iteration 3 --

Warning: array_combine() expects parameter 1 to be array, integer given in %s 
on line %d
NULL
-- Iteration 4 --

Warning: array_combine() expects parameter 1 to be array, integer given in %s 
on line %d
NULL
-- Iteration 5 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 6 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 7 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 8 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 9 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 10 --

Warning: array_combine() expects parameter 1 to be array, null given in %s on 
line %d
NULL
-- Iteration 11 --

Warning: array_combine() expects parameter 1 to be array, null given in %s on 
line %d
NULL
-- Iteration 12 --

Warning: array_combine() expects parameter 1 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 13 --

Warning: array_combine() expects parameter 1 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 14 --

Warning: array_combine() expects parameter 1 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 15 --

Warning: array_combine() expects parameter 1 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 16 --

Warning: array_combine() expects parameter 1 to be array, string given in %s on 
line %d
NULL
-- Iteration 17 --

Warning: array_combine() expects parameter 1 to be array, string given in %s on 
line %d
NULL
-- Iteration 18 --

Warning: array_combine() expects parameter 1 to be array, string given in %s on 
line %d
NULL
-- Iteration 19 --

Warning: array_combine() expects parameter 1 to be array, string given in %s on 
line %d
NULL
-- Iteration 20 --

Warning: array_combine() expects parameter 1 to be array, string given in %s on 
line %d
NULL
-- Iteration 21 --

Warning: array_combine() expects parameter 1 to be array, object given in %s on 
line %d
NULL
-- Iteration 22 --

Warning: array_combine() expects parameter 1 to be array, null given in %s on 
line %d
NULL
-- Iteration 23 --

Warning: array_combine() expects parameter 1 to be array, null given in %s on 
line %d
NULL
-- Iteration 24 --

Warning: array_combine() expects parameter 1 to be array, resource given in %s 
on line %d
NULL
Done
--UEXPECTF--
*** Testing array_combine() : Passing non-array values to $keys argument ***
-- Iteration 1 --

Warning: array_combine() expects parameter 1 to be array, integer given in %s 
on line %d
NULL
-- Iteration 2 --

Warning: array_combine() expects parameter 1 to be array, integer given in %s 
on line %d
NULL
-- Iteration 3 --

Warning: array_combine() expects parameter 1 to be array, integer given in %s 
on line %d
NULL
-- Iteration 4 --

Warning: array_combine() expects parameter 1 to be array, integer given in %s 
on line %d
NULL
-- Iteration 5 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 6 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 7 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 8 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 9 --

Warning: array_combine() expects parameter 1 to be array, double given in %s on 
line %d
NULL
-- Iteration 10 --

Warning: array_combine() expects parameter 1 to be array, null given in %s on 
line %d
NULL
-- Iteration 11 --

Warning: array_combine() expects parameter 1 to be array, null given in %s on 
line %d
NULL
-- Iteration 12 --

Warning: array_combine() expects parameter 1 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 13 --

Warning: array_combine() expects parameter 1 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 14 --

Warning: array_combine() expects parameter 1 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 15 --

Warning: array_combine() expects parameter 1 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 16 --

Warning: array_combine() expects parameter 1 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 17 --

Warning: array_combine() expects parameter 1 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 18 --

Warning: array_combine() expects parameter 1 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 19 --

Warning: array_combine() expects parameter 1 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 20 --

Warning: array_combine() expects parameter 1 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 21 --

Warning: array_combine() expects parameter 1 to be array, object given in %s on 
line %d
NULL
-- Iteration 22 --

Warning: array_combine() expects parameter 1 to be array, null given in %s on 
line %d
NULL
-- Iteration 23 --

Warning: array_combine() expects parameter 1 to be array, null given in %s on 
line %d
NULL
-- Iteration 24 --

Warning: array_combine() expects parameter 1 to be array, resource given in %s 
on line %d
NULL
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_variation2.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_variation2.phpt
+++ php-src/ext/standard/tests/array/array_combine_variation2.phpt
--TEST--
Test array_combine() function : usage variations - unexpected values for 
'values' argument
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys 
 *              and the elements of the second as the corresponding values 
 * Source code: ext/standard/array.c
*/

/*
* Testing array_combine() function by passing values to $values argument other 
than arrays
* and see that function emits proper warning messages wherever expected.
* The $keys argument passed is a fixed array.
*/

echo "*** Testing array_combine() : Passing non-array values to \$values 
argument ***\n";

// Initialize $keys array
$keys = array(1, 2);

//get an unset variable
$unset_var = 10;
unset($unset_var);

// get a class
class classA
{
  public function __toString() {
    return "Class A object";
  }
}

// heredoc string
$heredoc = <<<EOT
hello world
EOT;

// get a resource variable
$fp = fopen(__FILE__, "r");

// unexpected values to be passed to $values argument
$values_passed = array(

       // int data
/*1*/  0,
       1,
       12345,
       -2345,

       // float data
/*5*/  10.5,
       -10.5,
       12.3456789000e10,
       12.3456789000E-10,
       .5,

       // null data
/*10*/ NULL,
       null,

       // boolean data
/*12*/ true,
       false,
       TRUE,
      FALSE,

       // empty data
/*16*/ "",
       '',

       // string data
/*18*/ "string",
       'string',
       $heredoc,

       // object data
/*21*/ new classA(),

       // undefined data
/*22*/ @$undefined_var,

       // unset data
/*23*/ @$unset_var,

       // resource variable
/*24*/ $fp
);

// loop through each element within $values_passed to check the behavior of 
array_combine()
$iterator = 1;
foreach($values_passed as $values) {
  echo "-- Iteration $iterator --\n";
  var_dump( array_combine($keys,$values) );
  $iterator++;
};

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : Passing non-array values to $values argument ***
-- Iteration 1 --

Warning: array_combine() expects parameter 2 to be array, integer given in %s 
on line %d
NULL
-- Iteration 2 --

Warning: array_combine() expects parameter 2 to be array, integer given in %s 
on line %d
NULL
-- Iteration 3 --

Warning: array_combine() expects parameter 2 to be array, integer given in %s 
on line %d
NULL
-- Iteration 4 --

Warning: array_combine() expects parameter 2 to be array, integer given in %s 
on line %d
NULL
-- Iteration 5 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 6 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 7 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 8 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 9 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 10 --

Warning: array_combine() expects parameter 2 to be array, null given in %s on 
line %d
NULL
-- Iteration 11 --

Warning: array_combine() expects parameter 2 to be array, null given in %s on 
line %d
NULL
-- Iteration 12 --

Warning: array_combine() expects parameter 2 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 13 --

Warning: array_combine() expects parameter 2 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 14 --

Warning: array_combine() expects parameter 2 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 15 --

Warning: array_combine() expects parameter 2 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 16 --

Warning: array_combine() expects parameter 2 to be array, string given in %s on 
line %d
NULL
-- Iteration 17 --

Warning: array_combine() expects parameter 2 to be array, string given in %s on 
line %d
NULL
-- Iteration 18 --

Warning: array_combine() expects parameter 2 to be array, string given in %s on 
line %d
NULL
-- Iteration 19 --

Warning: array_combine() expects parameter 2 to be array, string given in %s on 
line %d
NULL
-- Iteration 20 --

Warning: array_combine() expects parameter 2 to be array, string given in %s on 
line %d
NULL
-- Iteration 21 --

Warning: array_combine() expects parameter 2 to be array, object given in %s on 
line %d
NULL
-- Iteration 22 --

Warning: array_combine() expects parameter 2 to be array, null given in %s on 
line %d
NULL
-- Iteration 23 --

Warning: array_combine() expects parameter 2 to be array, null given in %s on 
line %d
NULL
-- Iteration 24 --

Warning: array_combine() expects parameter 2 to be array, resource given in %s 
on line %d
NULL
Done
--UEXPECTF--
*** Testing array_combine() : Passing non-array values to $values argument ***
-- Iteration 1 --

Warning: array_combine() expects parameter 2 to be array, integer given in %s 
on line %d
NULL
-- Iteration 2 --

Warning: array_combine() expects parameter 2 to be array, integer given in %s 
on line %d
NULL
-- Iteration 3 --

Warning: array_combine() expects parameter 2 to be array, integer given in %s 
on line %d
NULL
-- Iteration 4 --

Warning: array_combine() expects parameter 2 to be array, integer given in %s 
on line %d
NULL
-- Iteration 5 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 6 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 7 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 8 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 9 --

Warning: array_combine() expects parameter 2 to be array, double given in %s on 
line %d
NULL
-- Iteration 10 --

Warning: array_combine() expects parameter 2 to be array, null given in %s on 
line %d
NULL
-- Iteration 11 --

Warning: array_combine() expects parameter 2 to be array, null given in %s on 
line %d
NULL
-- Iteration 12 --

Warning: array_combine() expects parameter 2 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 13 --

Warning: array_combine() expects parameter 2 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 14 --

Warning: array_combine() expects parameter 2 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 15 --

Warning: array_combine() expects parameter 2 to be array, boolean given in %s 
on line %d
NULL
-- Iteration 16 --

Warning: array_combine() expects parameter 2 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 17 --

Warning: array_combine() expects parameter 2 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 18 --

Warning: array_combine() expects parameter 2 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 19 --

Warning: array_combine() expects parameter 2 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 20 --

Warning: array_combine() expects parameter 2 to be array, Unicode string given 
in %s on line %d
NULL
-- Iteration 21 --

Warning: array_combine() expects parameter 2 to be array, object given in %s on 
line %d
NULL
-- Iteration 22 --

Warning: array_combine() expects parameter 2 to be array, null given in %s on 
line %d
NULL
-- Iteration 23 --

Warning: array_combine() expects parameter 2 to be array, null given in %s on 
line %d
NULL
-- Iteration 24 --

Warning: array_combine() expects parameter 2 to be array, resource given in %s 
on line %d
NULL
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_variation3.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_variation3.phpt
+++ php-src/ext/standard/tests/array/array_combine_variation3.phpt
--TEST--
Test array_combine() function : usage variations - different arrays
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys
 *              and the elements of the second as the corresponding values
 * Source code: ext/standard/array.c
*/

/*
* Passing different types of arrays to both $keys and $values arguments and 
testing whether 
* array_combine() behaves in an expected way with the arguments passed to the 
function
*/

echo "*** Testing array_combine() : Passing different types of arrays to both 
\$keys and \$values argument ***\n";

/* Different heredoc strings passed as argument to arrays */
// heredoc with blank line
$blank_line = <<<EOT


EOT;

// heredoc with multiline string
$multiline_string = <<<EOT
hello world
The quick brown fox jumped over;
the lazy dog
This is a double quoted string
EOT;

// heredoc with diferent whitespaces
$diff_whitespaces = <<<EOT
hello\r world\t
1111\t\t != 2222\v\v
heredoc\ndouble quoted string. with\vdifferent\fwhite\vspaces
EOT;

// heredoc with quoted strings and numeric values
$numeric_string = <<<EOT
11 < 12. 123 >22
'single quoted string'
"double quoted string"
2222 != 1111.\t 0000 = 0000\n
EOT;

// arrays passed to $keys argument
$arrays = array (
/*1*/  array(1, 2), // with default keys and numeric values
       array(1.1, 2.2), // with default keys & float values
       array(false,true), // with default keys and boolean values
       array(), // empty array
/*5*/  array(NULL), // with NULL
       array("a\v\f","aaaa\r","b","b\tbbb","c","[EMAIL PROTECTED]&\*\(\)\{\}"), 
 // with double quoted strings
       array('a\v\f','aaaa\r','b','b\tbbb','c','[EMAIL PROTECTED]&\*\(\)\{\}'), 
 // with single quoted strings
       array("h1" => $blank_line, "h2" => $multiline_string, "h3" => 
$diff_whitespaces, $numeric_string),  // with heredocs

       // associative arrays
/*9*/  array(1 => "one", 2 => "two", 3 => "three"),  // explicit numeric keys, 
string values
       array("one" => 1, "two" => 2, "three" => 3 ),  // string keys & numeric 
values
       array( 1 => 10, 2 => 20, 4 => 40, 3 => 30),  // explicit numeric keys 
and numeric values
       array( "one" => "ten", "two" => "twenty", "three" => "thirty"),  // 
string key/value
       array("one" => 1, 2 => "two", 4 => "four"),  //mixed

       // associative array, containing null/empty/boolean values as key/value
/*14*/ array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
       array(true => "true", false => "false", "false" => false, "true" => 
true),
       array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
       array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
       array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),

       // array with repetative keys
/*19*/ array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
);

// loop through each sub-array within $arrays to check the behavior of 
array_combine()
// same arrays are passed to both $keys and $values
$iterator = 1;
foreach($arrays as $array) {
  echo "-- Iteration $iterator --\n";
  var_dump( array_combine($array, $array) );
  $iterator++;
}

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : Passing different types of arrays to both $keys 
and $values argument ***
-- Iteration 1 --
array(2) {
  [1]=>
  int(1)
  [2]=>
  int(2)
}
-- Iteration 2 --
array(2) {
  [1]=>
  float(1.1)
  [2]=>
  float(2.2)
}
-- Iteration 3 --
array(2) {
  [""]=>
  bool(false)
  [1]=>
  bool(true)
}
-- Iteration 4 --

Warning: array_combine(): Both parameters should have at least 1 element in %s 
on line %d
bool(false)
-- Iteration 5 --
array(1) {
  [""]=>
  NULL
}
-- Iteration 6 --
array(6) {
  ["a"]=>
  string(3) "a"
  ["aaaa"]=>
  string(5) "aaaa"
  ["b"]=>
  string(1) "b"
  ["b   bbb"]=>
  string(5) "b  bbb"
  ["c"]=>
  string(1) "c"
  ["[EMAIL PROTECTED]&\*\(\)\{\}"]=>
  string(27) "[EMAIL PROTECTED]&\*\(\)\{\}"
}
-- Iteration 7 --
array(6) {
  ["a\v\f"]=>
  string(5) "a\v\f"
  ["aaaa\r"]=>
  string(6) "aaaa\r"
  ["b"]=>
  string(1) "b"
  ["b\tbbb"]=>
  string(6) "b\tbbb"
  ["c"]=>
  string(1) "c"
  ["[EMAIL PROTECTED]&\*\(\)\{\}"]=>
  string(28) "[EMAIL PROTECTED]&\*\(\)\{\}"
}
-- Iteration 8 --
array(4) {
  ["
"]=>
  string(1) "
"
  ["hello world
The quick brown fox jumped over;
the lazy dog
This is a double quoted string"]=>
  string(88) "hello world
The quick brown fox jumped over;
the lazy dog
This is a double quoted string"
  ["hello world 
1111             != 2222
heredoc
double quoted string. withdifferentwhitespaces"]=>
  string(88) "hello world       
1111             != 2222
heredoc
double quoted string. withdifferentwhitespaces"
  ["11 < 12. 123 >22
'single quoted string'
"double quoted string"
2222 != 1111.    0000 = 0000
"]=>
  string(90) "11 < 12. 123 >22
'single quoted string'
"double quoted string"
2222 != 1111.    0000 = 0000
"
}
-- Iteration 9 --
array(3) {
  ["one"]=>
  string(3) "one"
  ["two"]=>
  string(3) "two"
  ["three"]=>
  string(5) "three"
}
-- Iteration 10 --
array(3) {
  [1]=>
  int(1)
  [2]=>
  int(2)
  [3]=>
  int(3)
}
-- Iteration 11 --
array(4) {
  [10]=>
  int(10)
  [20]=>
  int(20)
  [40]=>
  int(40)
  [30]=>
  int(30)
}
-- Iteration 12 --
array(3) {
  ["ten"]=>
  string(3) "ten"
  ["twenty"]=>
  string(6) "twenty"
  ["thirty"]=>
  string(6) "thirty"
}
-- Iteration 13 --
array(3) {
  [1]=>
  int(1)
  ["two"]=>
  string(3) "two"
  ["four"]=>
  string(4) "four"
}
-- Iteration 14 --
array(2) {
  ["null"]=>
  string(4) "null"
  [""]=>
  NULL
}
-- Iteration 15 --
array(4) {
  ["true"]=>
  string(4) "true"
  ["false"]=>
  string(5) "false"
  [""]=>
  bool(false)
  [1]=>
  bool(true)
}
-- Iteration 16 --
array(2) {
  ["emptys"]=>
  string(6) "emptys"
  [""]=>
  string(0) ""
}
-- Iteration 17 --
array(2) {
  [""]=>
  bool(false)
  [1]=>
  bool(true)
}
-- Iteration 18 --
array(3) {
  [4]=>
  int(4)
  [5]=>
  int(5)
  [6]=>
  int(6)
}
-- Iteration 19 --
array(3) {
  [10]=>
  int(10)
  [20]=>
  int(20)
  [3]=>
  int(3)
}
Done
--UEXPECTF--
*** Testing array_combine() : Passing different types of arrays to both $keys 
and $values argument ***
-- Iteration 1 --
array(2) {
  [1]=>
  int(1)
  [2]=>
  int(2)
}
-- Iteration 2 --
array(2) {
  [1]=>
  float(1.1)
  [2]=>
  float(2.2)
}
-- Iteration 3 --
array(2) {
  [u""]=>
  bool(false)
  [1]=>
  bool(true)
}
-- Iteration 4 --

Warning: array_combine(): Both parameters should have at least 1 element in %s 
on line %d
bool(false)
-- Iteration 5 --
array(1) {
  [u""]=>
  NULL
}
-- Iteration 6 --
array(6) {
  [u"a"]=>
  unicode(3) "a"
  [u"aaaa"]=>
  unicode(5) "aaaa"
  [u"b"]=>
  unicode(1) "b"
  [u"b  bbb"]=>
  unicode(5) "b bbb"
  [u"c"]=>
  unicode(1) "c"
  [u"[EMAIL PROTECTED]&\*\(\)\{\}"]=>
  unicode(27) "[EMAIL PROTECTED]&\*\(\)\{\}"
}
-- Iteration 7 --
array(6) {
  [u"a\v\f"]=>
  unicode(5) "a\v\f"
  [u"aaaa\r"]=>
  unicode(6) "aaaa\r"
  [u"b"]=>
  unicode(1) "b"
  [u"b\tbbb"]=>
  unicode(6) "b\tbbb"
  [u"c"]=>
  unicode(1) "c"
  [u"[EMAIL PROTECTED]&\*\(\)\{\}"]=>
  unicode(28) "[EMAIL PROTECTED]&\*\(\)\{\}"
}
-- Iteration 8 --
array(4) {
  [u"
"]=>
  unicode(1) "
"
  [u"hello world
The quick brown fox jumped over;
the lazy dog
This is a double quoted string"]=>
  unicode(88) "hello world
The quick brown fox jumped over;
the lazy dog
This is a double quoted string"
  [u"hello world        
1111             != 2222
heredoc
double quoted string. withdifferentwhitespaces"]=>
  unicode(88) "hello world      
1111             != 2222
heredoc
double quoted string. withdifferentwhitespaces"
  [u"11 < 12. 123 >22
'single quoted string'
"double quoted string"
2222 != 1111.    0000 = 0000
"]=>
  unicode(90) "11 < 12. 123 >22
'single quoted string'
"double quoted string"
2222 != 1111.    0000 = 0000
"
}
-- Iteration 9 --
array(3) {
  [u"one"]=>
  unicode(3) "one"
  [u"two"]=>
  unicode(3) "two"
  [u"three"]=>
  unicode(5) "three"
}
-- Iteration 10 --
array(3) {
  [1]=>
  int(1)
  [2]=>
  int(2)
  [3]=>
  int(3)
}
-- Iteration 11 --
array(4) {
  [10]=>
  int(10)
  [20]=>
  int(20)
  [40]=>
  int(40)
  [30]=>
  int(30)
}
-- Iteration 12 --
array(3) {
  [u"ten"]=>
  unicode(3) "ten"
  [u"twenty"]=>
  unicode(6) "twenty"
  [u"thirty"]=>
  unicode(6) "thirty"
}
-- Iteration 13 --
array(3) {
  [1]=>
  int(1)
  [u"two"]=>
  unicode(3) "two"
  [u"four"]=>
  unicode(4) "four"
}
-- Iteration 14 --
array(2) {
  [u"null"]=>
  unicode(4) "null"
  [u""]=>
  NULL
}
-- Iteration 15 --
array(4) {
  [u"true"]=>
  unicode(4) "true"
  [u"false"]=>
  unicode(5) "false"
  [u""]=>
  bool(false)
  [1]=>
  bool(true)
}
-- Iteration 16 --
array(2) {
  [u"emptys"]=>
  unicode(6) "emptys"
  [u""]=>
  unicode(0) ""
}
-- Iteration 17 --
array(2) {
  [u""]=>
  bool(false)
  [1]=>
  bool(true)
}
-- Iteration 18 --
array(3) {
  [4]=>
  int(4)
  [5]=>
  int(5)
  [6]=>
  int(6)
}
-- Iteration 19 --
array(3) {
  [10]=>
  int(10)
  [20]=>
  int(20)
  [3]=>
  int(3)
}
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_variation4.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_variation4.phpt
+++ php-src/ext/standard/tests/array/array_combine_variation4.phpt
--TEST--
Test array_combine() function : usage variations - associative array with 
different keys
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys
 *              and the elements of the second as the corresponding values
 * Source code: ext/standard/array.c
*/

/*
 * Testing the functionality of array_combine() by passing different
 * associative arrays having different possible keys to $keys argument and 
 * associative arrays having different possible keys to $values argument.
*/

echo "*** Testing array_combine() : assoc array with diff keys to both \$keys 
and \$values argument ***\n";

// get an unset variable
$unset_var = 10;
unset ($unset_var);

// get a resource variable
$fp = fopen(__FILE__, "r");

// get a class
class classA
{
  public function __toString(){
    return "Class A object";
  }
}

// get a heredoc string
$heredoc = <<<EOT
Hello world
EOT;

// different variations of associative arrays to be passed to $arr1 argument
$arrays = array (

       // empty array
/*1*/  array(),

       // arrays with integer keys
       array(0 => "0"),
       array(1 => "1"),
       array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),

       // arrays with float keys
/*5*/  array(2.3333 => "float"),
       array(1.2 => "f1", 3.33 => "f2",
             4.89999922839999 => "f3",
             33333333.333333 => "f4"),

       // arrays with string keys
/*7*/  array('\tHello' => 111, 're\td' => "color",
             '\v\fworld' => 2.2, 'pen\n' => 33),
       array("\tHello" => 111, "re\td" => "color",
             "\v\fworld" => 2.2, "pen\n" => 33),
       array("hello", $heredoc => "string"), // heredoc

       // array with object, unset variable and resource variable
/*10*/ array(new classA() => 11, @$unset_var => "hello", $fp => 'resource'),

       // array with mixed keys
/*11*/ array('hello' => 1, new classA() => 2, "fruit" => 2.2,
             $fp => 'resource', 133 => "int", 444.432 => "float",
             @$unset_var => "unset", $heredoc => "heredoc")
);

// array to be passsed to $arr2 argument
$arr2 = array(0 => 0, 2 => "float", 4 => "f3", 33333333 => "f4",
              "\tHello" => 111, 2.2, 'color', "Hello world" => "string", 
              "pen\n" => 33, new classA() => 11, 133 => "int");

// loop through each sub-array within $arrays to check the behavior of 
array_combine()
// same arrays are passed to both $keys and $values
$iterator = 1;
foreach($arrays as $array) {
  echo "-- Iteration $iterator --\n";
  var_dump( array_combine($array, $array) );
  $iterator++;
}

// close the file resource used
fclose($fp);

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : assoc array with diff keys to both $keys and 
$values argument ***

Warning: Illegal offset type in %s on line %d

Warning: Illegal offset type in %s on line %d

Warning: Illegal offset type in %s on line %d

Warning: Illegal offset type in %s on line %d

Warning: Illegal offset type in %s on line %d
-- Iteration 1 --

Warning: array_combine(): Both parameters should have at least 1 element in %s 
on line %d
bool(false)
-- Iteration 2 --
array(1) {
  [0]=>
  string(1) "0"
}
-- Iteration 3 --
array(1) {
  [1]=>
  string(1) "1"
}
-- Iteration 4 --
array(4) {
  [1]=>
  string(1) "1"
  [2]=>
  string(1) "2"
  [3]=>
  string(1) "3"
  [4]=>
  string(1) "4"
}
-- Iteration 5 --
array(1) {
  ["float"]=>
  string(5) "float"
}
-- Iteration 6 --
array(4) {
  ["f1"]=>
  string(2) "f1"
  ["f2"]=>
  string(2) "f2"
  ["f3"]=>
  string(2) "f3"
  ["f4"]=>
  string(2) "f4"
}
-- Iteration 7 --
array(4) {
  [111]=>
  int(111)
  ["color"]=>
  string(5) "color"
  [2]=>
  float(2.2)
  [33]=>
  int(33)
}
-- Iteration 8 --
array(4) {
  [111]=>
  int(111)
  ["color"]=>
  string(5) "color"
  [2]=>
  float(2.2)
  [33]=>
  int(33)
}
-- Iteration 9 --
array(2) {
  ["hello"]=>
  string(5) "hello"
  ["string"]=>
  string(6) "string"
}
-- Iteration 10 --
array(1) {
  ["hello"]=>
  string(5) "hello"
}
-- Iteration 11 --
array(6) {
  [1]=>
  int(1)
  [2]=>
  float(2.2)
  ["int"]=>
  string(3) "int"
  ["float"]=>
  string(5) "float"
  ["unset"]=>
  string(5) "unset"
  ["heredoc"]=>
  string(7) "heredoc"
}
Done
--UEXPECTF--
*** Testing array_combine() : assoc array with diff keys to both $keys and 
$values argument ***

Warning: Illegal offset type in %s on line %d

Warning: Illegal offset type in %s on line %d

Warning: Illegal offset type in %s on line %d

Warning: Illegal offset type in %s on line %d

Warning: Illegal offset type in %s on line %d
-- Iteration 1 --

Warning: array_combine(): Both parameters should have at least 1 element in %s 
on line %d
bool(false)
-- Iteration 2 --
array(1) {
  [0]=>
  unicode(1) "0"
}
-- Iteration 3 --
array(1) {
  [1]=>
  unicode(1) "1"
}
-- Iteration 4 --
array(4) {
  [1]=>
  unicode(1) "1"
  [2]=>
  unicode(1) "2"
  [3]=>
  unicode(1) "3"
  [4]=>
  unicode(1) "4"
}
-- Iteration 5 --
array(1) {
  [u"float"]=>
  unicode(5) "float"
}
-- Iteration 6 --
array(4) {
  [u"f1"]=>
  unicode(2) "f1"
  [u"f2"]=>
  unicode(2) "f2"
  [u"f3"]=>
  unicode(2) "f3"
  [u"f4"]=>
  unicode(2) "f4"
}
-- Iteration 7 --
array(4) {
  [111]=>
  int(111)
  [u"color"]=>
  unicode(5) "color"
  [2]=>
  float(2.2)
  [33]=>
  int(33)
}
-- Iteration 8 --
array(4) {
  [111]=>
  int(111)
  [u"color"]=>
  unicode(5) "color"
  [2]=>
  float(2.2)
  [33]=>
  int(33)
}
-- Iteration 9 --
array(2) {
  [u"hello"]=>
  unicode(5) "hello"
  [u"string"]=>
  unicode(6) "string"
}
-- Iteration 10 --
array(1) {
  [u"hello"]=>
  unicode(5) "hello"
}
-- Iteration 11 --
array(6) {
  [1]=>
  int(1)
  [2]=>
  float(2.2)
  [u"int"]=>
  unicode(3) "int"
  [u"float"]=>
  unicode(5) "float"
  [u"unset"]=>
  unicode(5) "unset"
  [u"heredoc"]=>
  unicode(7) "heredoc"
}
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_variation5.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_variation5.phpt
+++ php-src/ext/standard/tests/array/array_combine_variation5.phpt
--TEST--
Test array_combine() function : usage variations - associative array with 
different values
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys
 *              and the elements of the second as the corresponding values
 * Source code: ext/standard/array.c
*/

/*
* Testing the functionality of array_combine() by passing various
* associative arrays having different possible values to $keys argument and
* associative arrays having different possible values to $values argument.
*/

echo "*** Testing array_combine() : assoc array with diff values to both \$keys 
and \$values argument ***\n";

// get an unset variable
$unset_var = 10;
unset ($unset_var);

// get a resource variable
$fp = fopen(__FILE__, "r");

// get a class
class classA
{
public function __toString(){
return "Class A object";
}
}

// get a heredoc string
$heredoc = <<<EOT
Hello world
EOT;

// different variations of associative array
$arrays = array (

       // empty array
/*1*/  array(),

       // arrays with integer values
       array('0' => 0),
       array("1" => 1),
       array("one" => 1, 'two' => 2, "three" => 3, 4 => 4),

       // arrays with float values
/*5*/  array("float" => 2.3333),
       array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 
33333333.333),

       // arrays with string values
/*7*/  array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 =>  
"pen\n"),
       array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 =>  
'pen\n'),
       array(1 => "hello", "heredoc" => $heredoc),

       // array with object, unset variable and resource variable
/*10*/ array(11 => new classA(), "unset" => @$unset_var, "resource" => $fp),

       // array with mixed values
/*11*/ array(1 => 'hello', 2 => new classA(), 222 => "fruit", 
             'resource' => $fp, "int" => 133, "float" => 444.432, 
             "unset" => @$unset_var, "heredoc" => $heredoc)
);


// loop through each sub-array within $arrays to check the behavior of 
array_combine()
$iterator = 1;
foreach($arrays as $array) {
  echo "-- Iteration $iterator --\n";
  var_dump( array_combine($array, $array) );
  $iterator++;
}

// close the file resource used
fclose($fp);

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : assoc array with diff values to both $keys and 
$values argument ***
-- Iteration 1 --

Warning: array_combine(): Both parameters should have at least 1 element in %s 
on line %d
bool(false)
-- Iteration 2 --
array(1) {
  [0]=>
  int(0)
}
-- Iteration 3 --
array(1) {
  [1]=>
  int(1)
}
-- Iteration 4 --
array(4) {
  [1]=>
  int(1)
  [2]=>
  int(2)
  [3]=>
  int(3)
  [4]=>
  int(4)
}
-- Iteration 5 --
array(1) {
  [2]=>
  float(2.3333)
}
-- Iteration 6 --
array(4) {
  [1]=>
  float(1.2)
  [3]=>
  float(3.33)
  [4]=>
  float(4.8999992284)
  [33333333]=>
  float(33333333.333)
}
-- Iteration 7 --
array(4) {
  ["    Hello"]=>
  string(6) "   Hello"
  ["col or"]=>
  string(6) "col        or"
  ["world"]=>
  string(7) "world"
  ["pen
"]=>
  string(4) "pen
"
}
-- Iteration 8 --
array(4) {
  ["\tHello"]=>
  string(7) "\tHello"
  ["col\tor"]=>
  string(7) "col\tor"
  ["\v\fworld"]=>
  string(9) "\v\fworld"
  ["pen\n"]=>
  string(5) "pen\n"
}
-- Iteration 9 --
array(2) {
  ["hello"]=>
  string(5) "hello"
  ["Hello world"]=>
  string(11) "Hello world"
}
-- Iteration 10 --
array(3) {
  ["Class A object"]=>
  object(classA)#%d (0) {
  }
  [""]=>
  NULL
  ["Resource id #%d"]=>
  resource(%d) of type (stream)
}
-- Iteration 11 --
array(8) {
  ["hello"]=>
  string(5) "hello"
  ["Class A object"]=>
  object(classA)#%d (0) {
  }
  ["fruit"]=>
  string(5) "fruit"
  ["Resource id #%d"]=>
  resource(%d) of type (stream)
  [133]=>
  int(133)
  [444]=>
  float(444.432)
  [""]=>
  NULL
  ["Hello world"]=>
  string(11) "Hello world"
}
Done
--UEXPECTF--
*** Testing array_combine() : assoc array with diff values to both $keys and 
$values argument ***
-- Iteration 1 --

Warning: array_combine(): Both parameters should have at least 1 element in %s 
on line %d
bool(false)
-- Iteration 2 --
array(1) {
  [0]=>
  int(0)
}
-- Iteration 3 --
array(1) {
  [1]=>
  int(1)
}
-- Iteration 4 --
array(4) {
  [1]=>
  int(1)
  [2]=>
  int(2)
  [3]=>
  int(3)
  [4]=>
  int(4)
}
-- Iteration 5 --
array(1) {
  [2]=>
  float(2.3333)
}
-- Iteration 6 --
array(4) {
  [1]=>
  float(1.2)
  [3]=>
  float(3.33)
  [4]=>
  float(4.8999992284)
  [33333333]=>
  float(33333333.333)
}
-- Iteration 7 --
array(4) {
  [u"   Hello"]=>
  unicode(6) "  Hello"
  [u"col        or"]=>
  unicode(6) "col       or"
  [u"world"]=>
  unicode(7) "world"
  [u"pen
"]=>
  unicode(4) "pen
"
}
-- Iteration 8 --
array(4) {
  [u"\tHello"]=>
  unicode(7) "\tHello"
  [u"col\tor"]=>
  unicode(7) "col\tor"
  [u"\v\fworld"]=>
  unicode(9) "\v\fworld"
  [u"pen\n"]=>
  unicode(5) "pen\n"
}
-- Iteration 9 --
array(2) {
  [u"hello"]=>
  unicode(5) "hello"
  [u"Hello world"]=>
  unicode(11) "Hello world"
}
-- Iteration 10 --
array(3) {
  [u"Class A object"]=>
  object(classA)#%d (0) {
  }
  [u""]=>
  NULL
  [u"Resource id #%d"]=>
  resource(%d) of type (stream)
}
-- Iteration 11 --
array(8) {
  [u"hello"]=>
  unicode(5) "hello"
  [u"Class A object"]=>
  object(classA)#%d (0) {
  }
  [u"fruit"]=>
  unicode(5) "fruit"
  [u"Resource id #%d"]=>
  resource(%d) of type (stream)
  [133]=>
  int(133)
  [444]=>
  float(444.432)
  [u""]=>
  NULL
  [u"Hello world"]=>
  unicode(11) "Hello world"
}
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_variation6.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_variation6.phpt
+++ php-src/ext/standard/tests/array/array_combine_variation6.phpt
--TEST--
Test array_combine() function : usage variations - binary safe checking 
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys
 *              and the elements of the second as the corresponding values
 * Source code: ext/standard/array.c
*/

/*
* Testing the behavior of array_combine() by passing array with 
* binary values for $keys and $values argument. 
*/

echo "*** Testing array_combine() : binary safe checking ***\n";

// array with binary values
$arr_binary = array(b"hello", b"world");
$arr_normal = array("hello", "world");

// array with binary value for $keys and $values argument
var_dump( array_combine($arr_binary, $arr_binary) );

// array with binary value for $values argument
var_dump( array_combine($arr_normal, $arr_binary) );

// array with binary value for $keys argument
var_dump( array_combine($arr_binary, $arr_normal) );

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : binary safe checking ***
array(2) {
  ["hello"]=>
  string(5) "hello"
  ["world"]=>
  string(5) "world"
}
array(2) {
  ["hello"]=>
  string(5) "hello"
  ["world"]=>
  string(5) "world"
}
array(2) {
  ["hello"]=>
  string(5) "hello"
  ["world"]=>
  string(5) "world"
}
Done
--UEXPECTF--
*** Testing array_combine() : binary safe checking ***
array(2) {
  ["hello"]=>
  string(5) "hello"
  ["world"]=>
  string(5) "world"
}
array(2) {
  [u"hello"]=>
  string(5) "hello"
  [u"world"]=>
  string(5) "world"
}
array(2) {
  ["hello"]=>
  unicode(5) "hello"
  ["world"]=>
  unicode(5) "world"
}
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_combine_basic.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_combine_basic.phpt
+++ php-src/ext/standard/tests/array/array_combine_basic.phpt
--TEST--
Test array_combine() function : basic functionality 
--FILE--
<?php
/* Prototype  : array array_combine(array $keys, array $values)
 * Description: Creates an array by using the elements of the first parameter 
as keys 
 *              and the elements of the second as the corresponding values 
 * Source code: ext/standard/array.c
*/

echo "*** Testing array_combine() : basic functionality ***\n";

/* Different arrays for $keys and $values arguments */

// array with default keys for $keys and $values arguments
$keys_array = array(1, 2);
$values_array = array(3,4);
var_dump( array_combine($keys_array, $values_array) );

// associative arrays for $keys and $values arguments
$keys_array = array(1 => "a", 2 => 'b');
$values_array = array(3 => 'c', 4 => "d");
var_dump( array_combine($keys_array, $values_array) );

// mixed array for $keys and $values arguments
$keys_array = array(1, 2 => "b");
$values_array = array(3 => 'c', 4);
var_dump( array_combine($keys_array, $values_array) );

echo "Done";
?>
--EXPECTF--
*** Testing array_combine() : basic functionality ***
array(2) {
  [1]=>
  int(3)
  [2]=>
  int(4)
}
array(2) {
  ["a"]=>
  string(1) "c"
  ["b"]=>
  string(1) "d"
}
array(2) {
  [1]=>
  string(1) "c"
  ["b"]=>
  int(4)
}
Done
--UEXPECTF--
*** Testing array_combine() : basic functionality ***
array(2) {
  [1]=>
  int(3)
  [2]=>
  int(4)
}
array(2) {
  [u"a"]=>
  unicode(1) "c"
  [u"b"]=>
  unicode(1) "d"
}
array(2) {
  [1]=>
  unicode(1) "c"
  [u"b"]=>
  int(4)
}
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to