mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00
31 lines
491 B
PHP
31 lines
491 B
PHP
--TEST--
|
|
Test arrays starting with negative indices
|
|
--FILE--
|
|
<?php
|
|
|
|
$a = array_fill(-2, 3, true);
|
|
$b = [-2 => true, true, true];
|
|
$c = ["string" => true, -2 => true, true, true];
|
|
unset($c["string"]);
|
|
$d[-2] = true;
|
|
$d[] = true;
|
|
$d[] = true;
|
|
$e = [-2 => false];
|
|
array_pop($e);
|
|
$e[] = true;
|
|
$e[] = true;
|
|
$e[] = true;
|
|
|
|
var_dump($a === $b && $b === $c && $c === $d && $d == $e);
|
|
var_dump($a);
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
array(3) {
|
|
[-2]=>
|
|
bool(true)
|
|
[-1]=>
|
|
bool(true)
|
|
[0]=>
|
|
bool(true)
|
|
}
|