2015-07-22 04:16:08 +08:00
|
|
|
--TEST--
|
|
|
|
string offset 003
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
// Test negative string offsets
|
|
|
|
|
|
|
|
function foo($x) {
|
2020-02-04 05:52:20 +08:00
|
|
|
var_dump($x);
|
2015-07-22 04:16:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$str = "abcdef";
|
|
|
|
var_dump($str[-10]);
|
|
|
|
var_dump($str[-3]);
|
|
|
|
var_dump($str[2][-2]);
|
|
|
|
var_dump($str[2][-1]);
|
|
|
|
|
|
|
|
foo($str[-10]);
|
|
|
|
foo($str[-3]);
|
|
|
|
foo($str[2][-2]);
|
|
|
|
foo($str[2][-1]);
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
2020-05-26 20:10:57 +08:00
|
|
|
Warning: Uninitialized string offset -10 in %s on line %d
|
2015-07-22 04:16:08 +08:00
|
|
|
string(0) ""
|
|
|
|
string(1) "d"
|
|
|
|
|
2020-05-26 20:10:57 +08:00
|
|
|
Warning: Uninitialized string offset -2 in %s on line %d
|
2015-07-22 04:16:08 +08:00
|
|
|
string(0) ""
|
|
|
|
string(1) "c"
|
|
|
|
|
2020-05-26 20:10:57 +08:00
|
|
|
Warning: Uninitialized string offset -10 in %s on line %d
|
2015-07-22 04:16:08 +08:00
|
|
|
string(0) ""
|
|
|
|
string(1) "d"
|
|
|
|
|
2020-05-26 20:10:57 +08:00
|
|
|
Warning: Uninitialized string offset -2 in %s on line %d
|
2015-07-22 04:16:08 +08:00
|
|
|
string(0) ""
|
|
|
|
string(1) "c"
|