mirror of
https://github.com/php/php-src.git
synced 2025-01-09 20:44:33 +08:00
- committig tests for array_key_exists() function
This commit is contained in:
parent
c345217eab
commit
b12ed7908d
34
ext/standard/tests/array/array_key_exists_basic.phpt
Normal file
34
ext/standard/tests/array/array_key_exists_basic.phpt
Normal file
@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : basic functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic functionality of array_key_exists()
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : basic functionality ***\n";
|
||||
|
||||
$key1 = 'key';
|
||||
$key2 = 'val';
|
||||
$search = array('one', 'key' => 'value', 'val');
|
||||
var_dump(array_key_exists($key1, $search));
|
||||
var_dump(array_key_exists($key2, $search));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : basic functionality ***
|
||||
bool(true)
|
||||
bool(false)
|
||||
Done
|
57
ext/standard/tests/array/array_key_exists_error.phpt
Normal file
57
ext/standard/tests/array/array_key_exists_error.phpt
Normal file
@ -0,0 +1,57 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : error conditions - Pass incorrect number of args
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass incorrect number of arguments to array_key_exists() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : error conditions ***\n";
|
||||
|
||||
//Test array_key_exists with one more than the expected number of arguments
|
||||
echo "\n-- Testing array_key_exists() function with more than expected no. of arguments --\n";
|
||||
$key = 1;
|
||||
$search = array(1, 2);
|
||||
$extra_arg = 10;
|
||||
var_dump( array_key_exists($key, $search, $extra_arg) );
|
||||
|
||||
// Testing array_key_exists with one less than the expected number of arguments
|
||||
echo "\n-- Testing array_key_exists() function with less than expected no. of arguments --\n";
|
||||
$key = 1;
|
||||
var_dump( array_key_exists($key) );
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : error conditions ***
|
||||
|
||||
-- Testing array_key_exists() function with more than expected no. of arguments --
|
||||
|
||||
Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing array_key_exists() function with less than expected no. of arguments --
|
||||
|
||||
Warning: array_key_exists() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : error conditions ***
|
||||
|
||||
-- Testing array_key_exists() function with more than expected no. of arguments --
|
||||
|
||||
Warning: array_key_exists() expects exactly 2 parameters, 3 given in %s on line %d
|
||||
NULL
|
||||
|
||||
-- Testing array_key_exists() function with less than expected no. of arguments --
|
||||
|
||||
Warning: array_key_exists() expects exactly 2 parameters, 1 given in %s on line %d
|
||||
NULL
|
||||
Done
|
111
ext/standard/tests/array/array_key_exists_object1.phpt
Normal file
111
ext/standard/tests/array/array_key_exists_object1.phpt
Normal file
@ -0,0 +1,111 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : object functionality
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test basic functionality of array_key_exists() with objects
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : object functionality ***\n";
|
||||
|
||||
class myClass {
|
||||
var $var1;
|
||||
var $var2;
|
||||
var $var3;
|
||||
|
||||
function __construct($a, $b, $c = null) {
|
||||
$this->var1 = $a;
|
||||
$this->var2 = $b;
|
||||
if (!is_null($c)) {
|
||||
$this->var3 = $c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n-- Do not assign a value to \$class1->var3 --\n";
|
||||
$class1 = new myClass ('a', 'b');
|
||||
echo "\$key = var1:\n";
|
||||
var_dump(array_key_exists('var1', $class1));
|
||||
echo "\$key = var3:\n";
|
||||
var_dump(array_key_exists('var3', $class1));
|
||||
echo "\$class1:\n";
|
||||
var_dump($class1);
|
||||
|
||||
echo "\n-- Assign a value to \$class2->var3 --\n";
|
||||
$class2 = new myClass('x', 'y', 'z');
|
||||
echo "\$key = var3:\n";
|
||||
var_dump(array_key_exists('var3', $class2));
|
||||
echo "\$class2:\n";
|
||||
var_dump($class2);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : object functionality ***
|
||||
|
||||
-- Do not assign a value to $class1->var3 --
|
||||
$key = var1:
|
||||
bool(true)
|
||||
$key = var3:
|
||||
bool(true)
|
||||
$class1:
|
||||
object(myClass)#%d (3) {
|
||||
["var1"]=>
|
||||
string(1) "a"
|
||||
["var2"]=>
|
||||
string(1) "b"
|
||||
["var3"]=>
|
||||
NULL
|
||||
}
|
||||
|
||||
-- Assign a value to $class2->var3 --
|
||||
$key = var3:
|
||||
bool(true)
|
||||
$class2:
|
||||
object(myClass)#%d (3) {
|
||||
["var1"]=>
|
||||
string(1) "x"
|
||||
["var2"]=>
|
||||
string(1) "y"
|
||||
["var3"]=>
|
||||
string(1) "z"
|
||||
}
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : object functionality ***
|
||||
|
||||
-- Do not assign a value to $class1->var3 --
|
||||
$key = var1:
|
||||
bool(true)
|
||||
$key = var3:
|
||||
bool(true)
|
||||
$class1:
|
||||
object(myClass)#%d (3) {
|
||||
[u"var1"]=>
|
||||
unicode(1) "a"
|
||||
[u"var2"]=>
|
||||
unicode(1) "b"
|
||||
[u"var3"]=>
|
||||
NULL
|
||||
}
|
||||
|
||||
-- Assign a value to $class2->var3 --
|
||||
$key = var3:
|
||||
bool(true)
|
||||
$class2:
|
||||
object(myClass)#%d (3) {
|
||||
[u"var1"]=>
|
||||
unicode(1) "x"
|
||||
[u"var2"]=>
|
||||
unicode(1) "y"
|
||||
[u"var3"]=>
|
||||
unicode(1) "z"
|
||||
}
|
||||
Done
|
117
ext/standard/tests/array/array_key_exists_object2.phpt
Normal file
117
ext/standard/tests/array/array_key_exists_object2.phpt
Normal file
@ -0,0 +1,117 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : object functionality - different visibilities
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass array_key_exists() an object with private and protected properties
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : object functionality ***\n";
|
||||
|
||||
class myClass {
|
||||
public $var1;
|
||||
protected $var2;
|
||||
private $var3;
|
||||
|
||||
function __construct($a, $b, $c = null) {
|
||||
$this->var1 = $a;
|
||||
$this->var2 = $b;
|
||||
if (!is_null($c)) {
|
||||
$this->var3 = $c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n-- Do not assign a value to \$class1->var3 --\n";
|
||||
$class1 = new myClass ('a', 'b');
|
||||
echo "\$key = var1:\n";
|
||||
var_dump(array_key_exists('var1', $class1));
|
||||
echo "\$key = var2:\n";
|
||||
var_dump(array_key_exists('var2', $class1));
|
||||
echo "\$key = var3:\n";
|
||||
var_dump(array_key_exists('var3', $class1));
|
||||
echo "\$class1:\n";
|
||||
var_dump($class1);
|
||||
|
||||
echo "\n-- Assign a value to \$class2->var3 --\n";
|
||||
$class2 = new myClass('x', 'y', 'z');
|
||||
echo "\$key = var3:\n";
|
||||
var_dump(array_key_exists('var3', $class2));
|
||||
echo "\$class2:\n";
|
||||
var_dump($class2);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : object functionality ***
|
||||
|
||||
-- Do not assign a value to $class1->var3 --
|
||||
$key = var1:
|
||||
bool(true)
|
||||
$key = var2:
|
||||
bool(false)
|
||||
$key = var3:
|
||||
bool(false)
|
||||
$class1:
|
||||
object(myClass)#%d (3) {
|
||||
["var1"]=>
|
||||
string(1) "a"
|
||||
["var2":protected]=>
|
||||
string(1) "b"
|
||||
["var3":"myClass":private]=>
|
||||
NULL
|
||||
}
|
||||
|
||||
-- Assign a value to $class2->var3 --
|
||||
$key = var3:
|
||||
bool(false)
|
||||
$class2:
|
||||
object(myClass)#%d (3) {
|
||||
["var1"]=>
|
||||
string(1) "x"
|
||||
["var2":protected]=>
|
||||
string(1) "y"
|
||||
["var3":"myClass":private]=>
|
||||
string(1) "z"
|
||||
}
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : object functionality ***
|
||||
|
||||
-- Do not assign a value to $class1->var3 --
|
||||
$key = var1:
|
||||
bool(true)
|
||||
$key = var2:
|
||||
bool(false)
|
||||
$key = var3:
|
||||
bool(false)
|
||||
$class1:
|
||||
object(myClass)#1 (3) {
|
||||
[u"var1"]=>
|
||||
unicode(1) "a"
|
||||
[u"var2":protected]=>
|
||||
unicode(1) "b"
|
||||
[u"var3":u"myClass":private]=>
|
||||
NULL
|
||||
}
|
||||
|
||||
-- Assign a value to $class2->var3 --
|
||||
$key = var3:
|
||||
bool(false)
|
||||
$class2:
|
||||
object(myClass)#2 (3) {
|
||||
[u"var1"]=>
|
||||
unicode(1) "x"
|
||||
[u"var2":protected]=>
|
||||
unicode(1) "y"
|
||||
[u"var3":u"myClass":private]=>
|
||||
unicode(1) "z"
|
||||
}
|
||||
Done
|
305
ext/standard/tests/array/array_key_exists_variation1.phpt
Normal file
305
ext/standard/tests/array/array_key_exists_variation1.phpt
Normal file
@ -0,0 +1,305 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : usage variations - Pass different data types as $key arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $key argument to array_key_exists() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$search = array ('zero', 'key' => 'val', 'two');
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// get a class
|
||||
class classA
|
||||
{
|
||||
public function __toString() {
|
||||
return "key";
|
||||
}
|
||||
}
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
key
|
||||
EOT;
|
||||
|
||||
// get a resource variable
|
||||
$fp = fopen(__FILE__, "r");
|
||||
|
||||
// unexpected values to be passed to $key argument
|
||||
$inputs = 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*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "key",
|
||||
'key',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of array_key_exists()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( array_key_exists($input, $search) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 2 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 3 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 20 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 21 --
|
||||
bool(true)
|
||||
|
||||
-- Iteration 22 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
Done
|
349
ext/standard/tests/array/array_key_exists_variation2.phpt
Normal file
349
ext/standard/tests/array/array_key_exists_variation2.phpt
Normal file
@ -0,0 +1,349 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : usage variations - Pass differnt data types to $search arg
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass different data types as $search argument to array_key_exists() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : usage variations ***\n";
|
||||
|
||||
// Initialise function arguments not being substituted
|
||||
$key = 'val';
|
||||
|
||||
//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 $search argument
|
||||
$inputs = 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*/ "",
|
||||
'',
|
||||
array(),
|
||||
|
||||
// string data
|
||||
/*19*/ "string",
|
||||
'string',
|
||||
$heredoc,
|
||||
|
||||
// object data
|
||||
/*22*/ new classA(),
|
||||
|
||||
// undefined data
|
||||
/*23*/ @$undefined_var,
|
||||
|
||||
// unset data
|
||||
/*24*/ @$unset_var,
|
||||
|
||||
// resource variable
|
||||
/*25*/ $fp
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of array_key_exists()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $input) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
var_dump( array_key_exists($key, $input) );
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
fclose($fp);
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 5 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 6 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 9 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 10 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 12 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 17 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 18 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 19 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 20 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 21 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 22 --
|
||||
bool(false)
|
||||
|
||||
-- Iteration 23 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 24 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 25 --
|
||||
|
||||
Warning: array_key_exists(): The second argument should be either an array or an object in %s on line %d
|
||||
bool(false)
|
||||
Done
|
87
ext/standard/tests/array/array_key_exists_variation3.phpt
Normal file
87
ext/standard/tests/array/array_key_exists_variation3.phpt
Normal file
@ -0,0 +1,87 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : usage variations - floats and casting to ints
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass floats as $key argument, then cast float values
|
||||
* to integers and pass as $key argument
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : usage variations ***\n";
|
||||
|
||||
$keys = array(1.2345678900E-10, 1.00000000000001, 1.99999999999999);
|
||||
|
||||
$search = array ('zero', 'one', 'two');
|
||||
|
||||
$iterator = 1;
|
||||
foreach($keys as $key) {
|
||||
echo "\n-- Iteration $iterator --\n";
|
||||
echo "Pass float as \$key:\n";
|
||||
var_dump(array_key_exists($key, $search));
|
||||
echo "Cast float to int:\n";
|
||||
var_dump(array_key_exists((int)$key, $search));
|
||||
}
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
Pass float as $key:
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
Cast float to int:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 1 --
|
||||
Pass float as $key:
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
Cast float to int:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 1 --
|
||||
Pass float as $key:
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
Cast float to int:
|
||||
bool(true)
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Iteration 1 --
|
||||
Pass float as $key:
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
Cast float to int:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 1 --
|
||||
Pass float as $key:
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
Cast float to int:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 1 --
|
||||
Pass float as $key:
|
||||
|
||||
Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
|
||||
bool(false)
|
||||
Cast float to int:
|
||||
bool(true)
|
||||
Done
|
66
ext/standard/tests/array/array_key_exists_variation4.phpt
Normal file
66
ext/standard/tests/array/array_key_exists_variation4.phpt
Normal file
@ -0,0 +1,66 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : usage variations - referenced variables
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass referenced variables as arguments to array_key_exists() to test behaviour
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : usage variations ***\n";
|
||||
|
||||
$array = array('one' => 1, 'two' => 2, 'three' => 3);
|
||||
|
||||
echo "\n-- \$search is a reference to \$array --\n";
|
||||
$search = &$array;
|
||||
var_dump(array_key_exists('one', $search));
|
||||
|
||||
echo "\n-- \$key is a referenced variable --\n";
|
||||
$key = 'two';
|
||||
var_dump(array_key_exists(&$key, $array));
|
||||
|
||||
echo "\n-- Both arguments are referenced variables --\n";
|
||||
var_dump(array_key_exists(&$key, &$array));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
Strict Standards: Call-time pass-by-reference has been deprecated in %s on line %d
|
||||
|
||||
Strict Standards: Call-time pass-by-reference has been deprecated in %s on line %d
|
||||
|
||||
Strict Standards: Call-time pass-by-reference has been deprecated in %s on line %d
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- $search is a reference to $array --
|
||||
bool(true)
|
||||
|
||||
-- $key is a referenced variable --
|
||||
bool(true)
|
||||
|
||||
-- Both arguments are referenced variables --
|
||||
bool(true)
|
||||
Done
|
||||
--UEXPECTF--
|
||||
Strict Standards: Call-time pass-by-reference has been deprecated in %s on line %d
|
||||
|
||||
Strict Standards: Call-time pass-by-reference has been deprecated in %s on line %d
|
||||
|
||||
Strict Standards: Call-time pass-by-reference has been deprecated in %s on line %d
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- $search is a reference to $array --
|
||||
bool(true)
|
||||
|
||||
-- $key is a referenced variable --
|
||||
bool(true)
|
||||
|
||||
-- Both arguments are referenced variables --
|
||||
bool(true)
|
||||
Done
|
48
ext/standard/tests/array/array_key_exists_variation5.phpt
Normal file
48
ext/standard/tests/array/array_key_exists_variation5.phpt
Normal file
@ -0,0 +1,48 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : usage variations - multidimensional arrays
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test how array_key_exists() behaves with multi-dimensional arrays
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : usage variations ***\n";
|
||||
|
||||
$multi_array = array ('zero' => 'val1',
|
||||
'one' => 'val2',
|
||||
'sub1' => array (1, 2, 3));
|
||||
|
||||
echo "\n-- Attempt to match key in sub-array --\n";
|
||||
// this key is in the sub-array
|
||||
var_dump(array_key_exists(0, $multi_array));
|
||||
|
||||
echo "\n-- \$search arg points to sub-array --\n";
|
||||
var_dump(array_key_exists(0, $multi_array['sub1']));
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Attempt to match key in sub-array --
|
||||
bool(false)
|
||||
|
||||
-- $search arg points to sub-array --
|
||||
bool(true)
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Attempt to match key in sub-array --
|
||||
bool(false)
|
||||
|
||||
-- $search arg points to sub-array --
|
||||
bool(true)
|
||||
Done
|
147
ext/standard/tests/array/array_key_exists_variation6.phpt
Normal file
147
ext/standard/tests/array/array_key_exists_variation6.phpt
Normal file
@ -0,0 +1,147 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : usage variations - equality test for certain data types
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass certain data types that can be taken as a key in an array
|
||||
* and test whether array_key_exists(() thinks they are equal and therefore
|
||||
* returns true when searching for them
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : usage variations ***\n";
|
||||
|
||||
$unset = 10;
|
||||
unset($unset);
|
||||
$array = array ('null' => null,
|
||||
'NULL' => NULL,
|
||||
'empty single quoted string' => '',
|
||||
"empty double quoted string" => "",
|
||||
'undefined variable' => @$undefined,
|
||||
'unset variable' => @$unset);
|
||||
|
||||
//iterate through original array
|
||||
foreach($array as $name => $input) {
|
||||
$iterator = 1;
|
||||
echo "\n-- Key in \$search array is : $name --\n";
|
||||
$search[$input] = 'test';
|
||||
|
||||
//iterate through array again to see which values are considered equal
|
||||
foreach($array as $key) {
|
||||
echo "Iteration $iterator: ";
|
||||
var_dump(array_key_exists($key, $search));
|
||||
$iterator++;
|
||||
}
|
||||
$search = null;
|
||||
}
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Key in $search array is : null --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : NULL --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : empty single quoted string --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : empty double quoted string --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : undefined variable --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : unset variable --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Key in $search array is : null --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : NULL --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : empty single quoted string --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : empty double quoted string --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : undefined variable --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
|
||||
-- Key in $search array is : unset variable --
|
||||
Iteration 1: bool(true)
|
||||
Iteration 2: bool(true)
|
||||
Iteration 3: bool(true)
|
||||
Iteration 4: bool(true)
|
||||
Iteration 5: bool(true)
|
||||
Iteration 6: bool(true)
|
||||
Done
|
45
ext/standard/tests/array/array_key_exists_variation7.phpt
Normal file
45
ext/standard/tests/array/array_key_exists_variation7.phpt
Normal file
@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : usage variations - position of internal array pointer
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Check the position of the internal array pointer after calling array_key_exists()
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : usage variations ***\n";
|
||||
|
||||
$input = array ('one' => 'un', 'two' => 'deux', 'three' => 'trois');
|
||||
|
||||
echo "\n-- Call array_key_exists() --\n";
|
||||
var_dump($result = array_key_exists('one', $input));
|
||||
|
||||
echo "\n-- Position of Internal Pointer in Original Array: --\n";
|
||||
echo key($input) . " => " . current ($input) . "\n";
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Call array_key_exists() --
|
||||
bool(true)
|
||||
|
||||
-- Position of Internal Pointer in Original Array: --
|
||||
one => un
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Call array_key_exists() --
|
||||
bool(true)
|
||||
|
||||
-- Position of Internal Pointer in Original Array: --
|
||||
one => un
|
||||
Done
|
982
ext/standard/tests/array/array_key_exists_variation8.phpt
Normal file
982
ext/standard/tests/array/array_key_exists_variation8.phpt
Normal file
@ -0,0 +1,982 @@
|
||||
--TEST--
|
||||
Test array_key_exists() function : usage variations - array keys are different data types
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : bool array_key_exists(mixed $key, array $search)
|
||||
* Description: Checks if the given key or index exists in the array
|
||||
* Source code: ext/standard/array.c
|
||||
* Alias to functions: key_exists
|
||||
*/
|
||||
|
||||
/*
|
||||
* Pass an array where the keys are different data types as the $search argument
|
||||
* then pass many different data types as $key argument to test where array_key_exist()
|
||||
* returns true.
|
||||
*/
|
||||
|
||||
echo "*** Testing array_key_exists() : usage variations ***\n";
|
||||
|
||||
//get an unset variable
|
||||
$unset_var = 10;
|
||||
unset ($unset_var);
|
||||
|
||||
// heredoc string
|
||||
$heredoc = <<<EOT
|
||||
string
|
||||
EOT;
|
||||
|
||||
// different data types to be iterated over
|
||||
$inputs = array(
|
||||
|
||||
// int data
|
||||
/*1*/ 'int' => array(
|
||||
0 => 'zero',
|
||||
1 => 'one',
|
||||
12345 => 'positive',
|
||||
-2345 => 'negative',
|
||||
),
|
||||
|
||||
// float data
|
||||
/*2*/ 'float' => array(
|
||||
10.5 => 'positive',
|
||||
-10.5 => 'negative',
|
||||
.5 => 'half',
|
||||
),
|
||||
|
||||
'extreme floats' => array(
|
||||
12.3456789000e10 => 'large',
|
||||
12.3456789000E-10 => 'small',
|
||||
),
|
||||
|
||||
// null data
|
||||
/*3*/ 'null uppercase' => array(
|
||||
NULL => 'null 1',
|
||||
),
|
||||
'null lowercase' => array(
|
||||
null => 'null 2',
|
||||
),
|
||||
|
||||
// boolean data
|
||||
/*4*/ 'bool lowercase' => array(
|
||||
true => 'lowert',
|
||||
false => 'lowerf',
|
||||
),
|
||||
'bool uppercase' => array(
|
||||
TRUE => 'uppert',
|
||||
FALSE => 'upperf',
|
||||
),
|
||||
|
||||
// empty data
|
||||
/*5*/ 'empty double quotes' => array(
|
||||
"" => 'emptyd',
|
||||
),
|
||||
'empty single quotes' => array(
|
||||
'' => 'emptys',
|
||||
),
|
||||
|
||||
// string data
|
||||
/*6*/ 'string' => array(
|
||||
"stringd" => 'stringd',
|
||||
'strings' => 'strings',
|
||||
$heredoc => 'stringh',
|
||||
),
|
||||
|
||||
// undefined data
|
||||
/*8*/ 'undefined' => array(
|
||||
@$undefined_var => 'undefined',
|
||||
),
|
||||
|
||||
// unset data
|
||||
/*9*/ 'unset' => array(
|
||||
@$unset_var => 'unset',
|
||||
),
|
||||
);
|
||||
|
||||
// loop through each element of $inputs to check the behavior of array_key_exists()
|
||||
$iterator = 1;
|
||||
foreach($inputs as $type => $input) {
|
||||
echo "\n-- Iteration $iterator: $type data --\n";
|
||||
|
||||
//iterate over again to get all different key values
|
||||
foreach ($inputs as $new_type => $new_input) {
|
||||
echo "-- \$key arguments are $new_type data:\n";
|
||||
foreach ($new_input as $key => $search) {
|
||||
var_dump(array_key_exists($key, $input));
|
||||
}
|
||||
}
|
||||
$iterator++;
|
||||
};
|
||||
|
||||
echo "Done";
|
||||
?>
|
||||
|
||||
--EXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Iteration 1: int data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2: float data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3: extreme floats data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4: null uppercase data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 5: null lowercase data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 6: bool lowercase data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7: bool uppercase data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8: empty double quotes data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 9: empty single quotes data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 10: string data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11: undefined data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 12: unset data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
Done
|
||||
--UEXPECTF--
|
||||
*** Testing array_key_exists() : usage variations ***
|
||||
|
||||
-- Iteration 1: int data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2: float data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 3: extreme floats data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 4: null uppercase data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 5: null lowercase data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 6: bool lowercase data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 7: bool uppercase data --
|
||||
-- $key arguments are int data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(true)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 8: empty double quotes data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 9: empty single quotes data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 10: string data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(false)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(false)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(false)
|
||||
-- $key arguments are string data:
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
-- $key arguments are undefined data:
|
||||
bool(false)
|
||||
-- $key arguments are unset data:
|
||||
bool(false)
|
||||
|
||||
-- Iteration 11: undefined data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
|
||||
-- Iteration 12: unset data --
|
||||
-- $key arguments are int data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are float data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are extreme floats data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are null uppercase data:
|
||||
bool(true)
|
||||
-- $key arguments are null lowercase data:
|
||||
bool(true)
|
||||
-- $key arguments are bool lowercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are bool uppercase data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are empty double quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are empty single quotes data:
|
||||
bool(true)
|
||||
-- $key arguments are string data:
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
-- $key arguments are undefined data:
|
||||
bool(true)
|
||||
-- $key arguments are unset data:
|
||||
bool(true)
|
||||
Done
|
Loading…
Reference in New Issue
Block a user