[5]=>
int(1000)
}
-array(8) {
+
+Warning: chr() expects parameter 1 to be long, Unicode string given in %s
+array(7) {
[0]=>
int(0)
[1]=>
int(100)
[5]=>
int(1000)
- [6]=>
- unicode(5) "Hello"
[7]=>
NULL
}
var_dump( array_key_exists($key_check_obj, $key_check_obj) );
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
*** Testing basic functionalities ***
-- Iteration 1 --
bool(true)
bool(false)
*** Testing operation on objects ***
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
bool(true)
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d
+bool(false)
Done
-- Do not assign a value to $class1->var3 --
$key = var1:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(true)
$key = var3:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(true)
$class1:
-object(myClass)#%d (3) {
- [u"var1"]=>
- unicode(1) "a"
- [u"var2"]=>
- unicode(1) "b"
- [u"var3"]=>
+object(myClass)#1 (3) {
+ [%b|u%"var1"]=>
+ %unicode|string%(1) "a"
+ [%b|u%"var2"]=>
+ %unicode|string%(1) "b"
+ [%b|u%"var3"]=>
NULL
}
-- Assign a value to $class2->var3 --
$key = var3:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(true)
$class2:
-object(myClass)#%d (3) {
- [u"var1"]=>
- unicode(1) "x"
- [u"var2"]=>
- unicode(1) "y"
- [u"var3"]=>
- unicode(1) "z"
+object(myClass)#2 (3) {
+ [%b|u%"var1"]=>
+ %unicode|string%(1) "x"
+ [%b|u%"var2"]=>
+ %unicode|string%(1) "y"
+ [%b|u%"var3"]=>
+ %unicode|string%(1) "z"
}
Done
-- Do not assign a value to $class1->var3 --
$key = var1:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(true)
$key = var2:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
$key = var3:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
$class1:
object(myClass)#1 (3) {
- [u"var1"]=>
- unicode(1) "a"
- [u"var2":protected]=>
- unicode(1) "b"
- [u"var3":u"myClass":private]=>
+ [%b|u%"var1"]=>
+ %unicode|string%(1) "a"
+ [%b|u%"var2":protected]=>
+ %unicode|string%(1) "b"
+ [%b|u%"var3":%b|u%"myClass":private]=>
NULL
}
-- Assign a value to $class2->var3 --
$key = var3:
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+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"
+ [%b|u%"var1"]=>
+ %unicode|string%(1) "x"
+ [%b|u%"var2":protected]=>
+ %unicode|string%(1) "y"
+ [%b|u%"var3":%b|u%"myClass":private]=>
+ %unicode|string%(1) "z"
}
Done
NULL
-- Iteration 22 --
-
-Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d
-NULL
+bool(false)
-- Iteration 23 --
*** Testing array_push() : error conditions ***
int(3)
array(3) {
- [-2147483647]=>
+ [-%d]=>
unicode(3) "min"
- [2147483647]=>
+ [%d]=>
unicode(3) "max"
- [-2147483648]=>
+ [-%d]=>
unicode(3) "new"
}
Warning: array_push(): Cannot add element to the array as the next element is already occupied in %s on line %d
bool(false)
array(3) {
- [-2147483647]=>
+ [-%d]=>
unicode(3) "min"
- [2147483647]=>
+ [%d]=>
unicode(3) "max"
- [-2147483648]=>
+ [-%d]=>
unicode(3) "new"
}
Done
echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n";
$input = array(1, 2);
$extra_arg = 10;
-var_dump( array_unique($input, $extra_arg) );
+var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) );
echo "Done";
?>
-- Testing array_unique() function with zero arguments --
-Warning: array_unique() expects exactly 1 parameter, 0 given in %s on line %d
+Warning: array_unique() expects at least 1 parameter, 0 given in %s on line %d
NULL
-- Testing array_unique() function with more than expected no. of arguments --
-Warning: array_unique() expects exactly 1 parameter, 2 given in %s on line %d
+Warning: array_unique() expects at most 2 parameters, 3 given in %s on line %d
NULL
Done
$iterator = 1;
foreach($inputs as $input) {
echo "-- Iteration $iterator --\n";
- var_dump( array_unique($input) );
+ var_dump( array_unique($input, SORT_STRING) );
$iterator++;
}
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing array_unique() : Passing different arrays to $input argument ***
-- Iteration 1 --
array(2) {
-- Iteration 6 --
array(4) {
[0]=>
- unicode(3) "a\v\f"
+ %unicode|string%(3) "a\v\f"
[1]=>
- unicode(5) "aaaa
+ %unicode|string%(5) "aaaa
"
[2]=>
- unicode(1) "b"
+ %unicode|string%(1) "b"
[4]=>
- unicode(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
+ %unicode|string%(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}"
}
-- Iteration 7 --
array(4) {
[0]=>
- unicode(5) "a\v\f"
+ %unicode|string%(5) "a\v\f"
[1]=>
- unicode(6) "aaaa\r"
+ %unicode|string%(6) "aaaa\r"
[2]=>
- unicode(1) "b"
+ %unicode|string%(1) "b"
[4]=>
- unicode(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
+ %unicode|string%(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}"
}
-- Iteration 8 --
array(3) {
- [u"h1"]=>
- unicode(1) "
+ [%b|u%"h1"]=>
+ %unicode|string%(1) "
"
- [u"h2"]=>
- unicode(88) "hello world
+ [%b|u%"h2"]=>
+ %unicode|string%(88) "hello world
The quick brown fox jumped over;
the lazy dog
This is a double quoted string"
- [u"h3"]=>
- unicode(88) "hello
+ [%b|u%"h3"]=>
+ %unicode|string%(88) "hello
world
1111 != 2222\v\v
heredoc
-- Iteration 9 --
array(2) {
[1]=>
- unicode(3) "one"
+ %unicode|string%(3) "one"
[2]=>
- unicode(3) "two"
+ %unicode|string%(3) "two"
}
-- Iteration 10 --
array(2) {
- [u"one"]=>
+ [%b|u%"one"]=>
int(1)
- [u"two"]=>
+ [%b|u%"two"]=>
int(2)
}
-- Iteration 11 --
}
-- Iteration 12 --
array(2) {
- [u"one"]=>
- unicode(3) "ten"
- [u"two"]=>
- unicode(6) "twenty"
+ [%b|u%"one"]=>
+ %unicode|string%(3) "ten"
+ [%b|u%"two"]=>
+ %unicode|string%(6) "twenty"
}
-- Iteration 13 --
array(3) {
- [u"one"]=>
+ [%b|u%"one"]=>
int(1)
[2]=>
- unicode(3) "two"
+ %unicode|string%(3) "two"
[4]=>
- unicode(4) "four"
+ %unicode|string%(4) "four"
}
-- Iteration 14 --
array(2) {
- [u""]=>
- unicode(4) "null"
- [u"NULL"]=>
+ [%b|u%""]=>
+ %unicode|string%(4) "null"
+ [%b|u%"NULL"]=>
NULL
}
-- Iteration 15 --
array(4) {
[1]=>
- unicode(4) "true"
+ %unicode|string%(4) "true"
[0]=>
- unicode(5) "false"
- [u"false"]=>
+ %unicode|string%(5) "false"
+ [%b|u%"false"]=>
bool(false)
- [u"true"]=>
+ [%b|u%"true"]=>
bool(true)
}
-- Iteration 16 --
array(2) {
- [u""]=>
- unicode(6) "emptys"
- [u"emptyd"]=>
- unicode(0) ""
+ [%b|u%""]=>
+ %unicode|string%(6) "emptys"
+ [%b|u%"emptyd"]=>
+ %unicode|string%(0) ""
}
-- Iteration 17 --
array(2) {
[1]=>
- unicode(0) ""
+ %unicode|string%(0) ""
[6]=>
bool(true)
}
-- Iteration 18 --
array(3) {
- [u""]=>
+ [%b|u%""]=>
int(4)
[0]=>
int(5)
5 => $value4
);
-var_dump( array_unique($input) );
+var_dump( array_unique($input, SORT_STRING) );
echo "Done";
?>
---EXPECT--
+--EXPECTF--
*** Testing array_unique() : array with reference variables for $input argument ***
array(2) {
[0]=>
int(0)
[1]=>
- &unicode(5) "hello"
+ &%unicode|string%(5) "hello"
}
Done
?>
--EXPECTF--
*** Testing array_walk() : object functionality ***
+%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value"
+int(10)
+int(1)
-Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d
-NULL
+%unicode|string%(9) "pub_value"
+int(10)
+int(1)
+
+%unicode|string%(12) "%r\0%r*%r\0%rpro_value"
+int(10)
+int(1)
+
+bool(true)
Done
echo "Done\n";
?>
--EXPECTF--
-Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d
-
-Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d
-
-Warning: array_walk() expects parameter 1 to be array, Unicode string given in %s on line %d
+%unicode|string%(3) "foo"
+%unicode|string%(3) "foo"
+%unicode|string%(3) "bar"
+%unicode|string%(3) "bar"
+%unicode|string%(13) "%r\0%rtest%r\0%rvar_pri"
+%unicode|string%(12) "test_private"
+%unicode|string%(10) "%r\0%r*%r\0%rvar_pro"
+%unicode|string%(14) "test_protected"
+%unicode|string%(7) "var_pub"
+%unicode|string%(11) "test_public"
+
+Warning: array_walk() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d
Done
echo "Done\n";
?>
--EXPECTF--
-Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d
-
-Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d
-
-Warning: array_walk_recursive() expects parameter 1 to be array, Unicode string given in %s on line %d
+%unicode|string%(3) "foo"
+%unicode|string%(3) "foo"
+%unicode|string%(3) "bar"
+%unicode|string%(3) "bar"
+%unicode|string%(13) "%r\0%rtest%r\0%rvar_pri"
+%unicode|string%(12) "test_private"
+%unicode|string%(10) "%r\0%r*%r\0%rvar_pro"
+%unicode|string%(14) "test_protected"
+%unicode|string%(7) "var_pub"
+%unicode|string%(11) "test_public"
+
+Warning: array_walk_recursive() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d
Done
?>
--EXPECTF--
*** Testing array_walk_recursive() : object functionality ***
+%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value"
+int(10)
+int(1)
-Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d
-NULL
+%unicode|string%(9) "pub_value"
+int(10)
+int(1)
+
+%unicode|string%(12) "%r\0%r*%r\0%rpro_value"
+int(10)
+int(1)
+
+bool(true)
Done
Bug #44929 (natsort doesn't handle leading zeros well)
--FILE--
<?php
-$a = array('001','008','005','00011','03','000014','-123','0.002','00','0');
+$a = array(b'001',b'008',b'005',b'00011',b'03',b'000014',b'-123',b'0.002',b'00',b'0');
natsort($a);
var_dump($a);
?>