1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/standard/tests/array/extract_negative_keys.phpt
2025-11-19 20:41:48 +00:00

32 lines
517 B
PHP

--TEST--
extract() with negative keys
--FILE--
<?php
$a = [-5 => 'hello', 'world', 2 => 'positive', 'check' => 'extracted'];
function foo(array $a) {
extract($a, EXTR_PREFIX_ALL, 'prefix');
var_dump(get_defined_vars());
}
foo($a);
?>
--EXPECT--
array(3) {
["a"]=>
array(4) {
[-5]=>
string(5) "hello"
[-4]=>
string(5) "world"
[2]=>
string(8) "positive"
["check"]=>
string(9) "extracted"
}
["prefix_2"]=>
string(8) "positive"
["prefix_check"]=>
string(9) "extracted"
}