mirror of
https://github.com/php/php-src.git
synced 2025-01-23 20:23:31 +08:00
239 lines
2.2 KiB
PHP
239 lines
2.2 KiB
PHP
--TEST--
|
|
array_chunk() - variation 17
|
|
--FILE--
|
|
<?php
|
|
$array = array (1, 2, 3, 4);
|
|
var_dump ($array);
|
|
for ($i = 0; $i < (sizeof($array) + 1); $i++) {
|
|
echo "[$i]\n";
|
|
var_dump (@array_chunk ($array, $i));
|
|
var_dump (@array_chunk ($array, $i, TRUE));
|
|
var_dump (@array_chunk ($array, $i, FALSE));
|
|
echo "\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
array(4) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
[2]=>
|
|
int(3)
|
|
[3]=>
|
|
int(4)
|
|
}
|
|
[0]
|
|
NULL
|
|
NULL
|
|
NULL
|
|
|
|
[1]
|
|
array(4) {
|
|
[0]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(1)
|
|
}
|
|
[1]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(2)
|
|
}
|
|
[2]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(3)
|
|
}
|
|
[3]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(4)
|
|
}
|
|
}
|
|
array(4) {
|
|
[0]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(1)
|
|
}
|
|
[1]=>
|
|
array(1) {
|
|
[1]=>
|
|
int(2)
|
|
}
|
|
[2]=>
|
|
array(1) {
|
|
[2]=>
|
|
int(3)
|
|
}
|
|
[3]=>
|
|
array(1) {
|
|
[3]=>
|
|
int(4)
|
|
}
|
|
}
|
|
array(4) {
|
|
[0]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(1)
|
|
}
|
|
[1]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(2)
|
|
}
|
|
[2]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(3)
|
|
}
|
|
[3]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(4)
|
|
}
|
|
}
|
|
|
|
[2]
|
|
array(2) {
|
|
[0]=>
|
|
array(2) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
}
|
|
[1]=>
|
|
array(2) {
|
|
[0]=>
|
|
int(3)
|
|
[1]=>
|
|
int(4)
|
|
}
|
|
}
|
|
array(2) {
|
|
[0]=>
|
|
array(2) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
}
|
|
[1]=>
|
|
array(2) {
|
|
[2]=>
|
|
int(3)
|
|
[3]=>
|
|
int(4)
|
|
}
|
|
}
|
|
array(2) {
|
|
[0]=>
|
|
array(2) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
}
|
|
[1]=>
|
|
array(2) {
|
|
[0]=>
|
|
int(3)
|
|
[1]=>
|
|
int(4)
|
|
}
|
|
}
|
|
|
|
[3]
|
|
array(2) {
|
|
[0]=>
|
|
array(3) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
[2]=>
|
|
int(3)
|
|
}
|
|
[1]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(4)
|
|
}
|
|
}
|
|
array(2) {
|
|
[0]=>
|
|
array(3) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
[2]=>
|
|
int(3)
|
|
}
|
|
[1]=>
|
|
array(1) {
|
|
[3]=>
|
|
int(4)
|
|
}
|
|
}
|
|
array(2) {
|
|
[0]=>
|
|
array(3) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
[2]=>
|
|
int(3)
|
|
}
|
|
[1]=>
|
|
array(1) {
|
|
[0]=>
|
|
int(4)
|
|
}
|
|
}
|
|
|
|
[4]
|
|
array(1) {
|
|
[0]=>
|
|
array(4) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
[2]=>
|
|
int(3)
|
|
[3]=>
|
|
int(4)
|
|
}
|
|
}
|
|
array(1) {
|
|
[0]=>
|
|
array(4) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
[2]=>
|
|
int(3)
|
|
[3]=>
|
|
int(4)
|
|
}
|
|
}
|
|
array(1) {
|
|
[0]=>
|
|
array(4) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
[2]=>
|
|
int(3)
|
|
[3]=>
|
|
int(4)
|
|
}
|
|
}
|