mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_using_values_null_as_an_array_offset_and_when_calling_array_key_exists
48 lines
616 B
PHP
48 lines
616 B
PHP
--TEST--
|
|
JIT FETCH_DIM_R: 002
|
|
--INI--
|
|
opcache.enable=1
|
|
opcache.enable_cli=1
|
|
opcache.file_update_protection=0
|
|
;opcache.jit_debug=257
|
|
--EXTENSIONS--
|
|
opcache
|
|
--FILE--
|
|
<?php
|
|
function foo($n) {
|
|
$a = array(1,2,3,""=>4,"ab"=>5,"2x"=>6);
|
|
var_dump($a[$n]);
|
|
}
|
|
foo(0);
|
|
foo(2);
|
|
foo(1.0);
|
|
foo("0");
|
|
foo("2");
|
|
foo(false);
|
|
foo(true);
|
|
foo(null);
|
|
foo("ab");
|
|
$x="a";
|
|
$y="b";
|
|
foo($x.$y);
|
|
foo("2x");
|
|
$x=2;
|
|
$y="x";
|
|
foo($x.$y);
|
|
?>
|
|
--EXPECTF--
|
|
int(1)
|
|
int(3)
|
|
int(2)
|
|
int(1)
|
|
int(3)
|
|
int(1)
|
|
int(2)
|
|
|
|
Deprecated: Using null as an array offset is deprecated, use an empty string instead in %s on line %d
|
|
int(4)
|
|
int(5)
|
|
int(5)
|
|
int(6)
|
|
int(6)
|