Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
--TEST--
|
2002-03-26 18:17:38 +00:00
|
|
|
Test array_merge and array_walk
|
2002-08-21 01:22:02 +00:00
|
|
|
--INI--
|
|
|
|
precision=14
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2003-08-18 22:57:49 +00:00
|
|
|
require(dirname(__FILE__) . '/data.inc');
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
/*
|
|
|
|
** Create sample arrays
|
|
|
|
** Test alpha, numeric (decimal, hex, octal) and special data
|
|
|
|
**
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Helper function to build testing arrays */
|
|
|
|
function make_nested_array ($depth, $breadth, $function = NULL, $args = array ()) {
|
|
|
|
for ($x = 0; $x < $breadth; ++$x) {
|
|
|
|
if (NULL === $function) {
|
|
|
|
$array = array (0);
|
|
|
|
} else {
|
|
|
|
$array = array (call_user_func_array ($function, $args));
|
|
|
|
}
|
|
|
|
for ($y = 1; $y < $depth; ++$y) {
|
|
|
|
$array[0] = array ($array[0]);
|
|
|
|
}
|
|
|
|
$temp[$x] = $array;
|
|
|
|
}
|
|
|
|
return $temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Nested array */
|
2002-03-26 18:17:38 +00:00
|
|
|
$data2 = make_nested_array (3, 3);
|
|
|
|
$data = array_merge($data, $data2);
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
|
2002-03-26 18:17:38 +00:00
|
|
|
var_dump ($data);
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
|
|
|
|
function echo_kv ($value, $key) {
|
|
|
|
var_dump ($key);
|
|
|
|
var_dump ($value);
|
|
|
|
}
|
|
|
|
|
2002-03-26 18:17:38 +00:00
|
|
|
echo " -- Testing array_walk() -- \n";
|
|
|
|
array_walk ($data, 'echo_kv');
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
2002-11-07 17:49:11 +00:00
|
|
|
array(11) {
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
[0]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
string(3) "PHP"
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
[1]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
string(27) "PHP: Hypertext Preprocessor"
|
|
|
|
[2]=>
|
|
|
|
string(4) "Test"
|
|
|
|
["test"]=>
|
|
|
|
int(27)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
[3]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
string(4) "test"
|
2003-08-13 10:40:28 +00:00
|
|
|
[4]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
array(2) {
|
|
|
|
[0]=>
|
|
|
|
string(6) "banana"
|
|
|
|
[1]=>
|
|
|
|
string(6) "orange"
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
}
|
|
|
|
[5]=>
|
2003-08-13 10:40:28 +00:00
|
|
|
string(6) "monkey"
|
2002-11-07 17:49:11 +00:00
|
|
|
[6]=>
|
2003-08-13 10:40:28 +00:00
|
|
|
float(-0.33333333333333)
|
|
|
|
[7]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
array(1) {
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
int(0)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
}
|
|
|
|
}
|
2002-03-26 18:17:38 +00:00
|
|
|
}
|
2003-08-13 10:40:28 +00:00
|
|
|
[8]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
int(0)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
}
|
|
|
|
}
|
2002-03-26 18:17:38 +00:00
|
|
|
}
|
2003-08-13 10:40:28 +00:00
|
|
|
[9]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
int(0)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-- Testing array_walk() --
|
|
|
|
int(0)
|
2002-03-26 18:17:38 +00:00
|
|
|
string(3) "PHP"
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
int(1)
|
2002-03-26 18:17:38 +00:00
|
|
|
string(27) "PHP: Hypertext Preprocessor"
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
int(2)
|
2002-03-26 18:17:38 +00:00
|
|
|
string(4) "Test"
|
|
|
|
string(4) "test"
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
int(27)
|
2002-03-26 18:17:38 +00:00
|
|
|
int(3)
|
|
|
|
string(4) "test"
|
2003-08-13 10:40:28 +00:00
|
|
|
int(4)
|
2002-03-26 18:17:38 +00:00
|
|
|
array(2) {
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
[0]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
string(6) "banana"
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
[1]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
string(6) "orange"
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
}
|
|
|
|
int(5)
|
2003-08-13 10:40:28 +00:00
|
|
|
string(6) "monkey"
|
2002-11-07 17:49:11 +00:00
|
|
|
int(6)
|
2003-08-13 10:40:28 +00:00
|
|
|
float(-0.33333333333333)
|
|
|
|
int(7)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
int(0)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-08-13 10:40:28 +00:00
|
|
|
int(8)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
int(0)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-08-13 10:40:28 +00:00
|
|
|
int(9)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
|
|
|
array(1) {
|
|
|
|
[0]=>
|
2002-03-26 18:17:38 +00:00
|
|
|
int(0)
|
Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.
Corrected prototype comments for all.
Converted to use zend_parse_parameters, except for the u.?sort functions.
Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().
Changed pval to zval in the u.?sort functions.
Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
|
|
|
}
|
|
|
|
}
|
2002-11-07 17:49:11 +00:00
|
|
|
}
|