2010-07-16 19:44:30 +08:00
|
|
|
--TEST--
|
|
|
|
string offset 001
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
function foo($x) {
|
|
|
|
var_dump($x);
|
|
|
|
}
|
|
|
|
|
|
|
|
$str = "abc";
|
|
|
|
var_dump($str[-1]);
|
|
|
|
var_dump($str[0]);
|
|
|
|
var_dump($str[1]);
|
|
|
|
var_dump($str[2]);
|
|
|
|
var_dump($str[3]);
|
|
|
|
var_dump($str[1][0]);
|
|
|
|
var_dump($str[2][1]);
|
|
|
|
|
|
|
|
foo($str[-1]);
|
|
|
|
foo($str[0]);
|
|
|
|
foo($str[1]);
|
|
|
|
foo($str[2]);
|
|
|
|
foo($str[3]);
|
|
|
|
foo($str[1][0]);
|
|
|
|
foo($str[2][1]);
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
2011-12-19 10:05:03 +08:00
|
|
|
Notice: Uninitialized string offset: -1 in %sstr_offset_001.php on line %d
|
2010-07-16 19:44:30 +08:00
|
|
|
string(0) ""
|
|
|
|
string(1) "a"
|
|
|
|
string(1) "b"
|
|
|
|
string(1) "c"
|
|
|
|
|
2011-12-19 10:05:03 +08:00
|
|
|
Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line %d
|
2010-07-16 19:44:30 +08:00
|
|
|
string(0) ""
|
|
|
|
string(1) "b"
|
|
|
|
|
2011-12-19 10:05:03 +08:00
|
|
|
Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line %d
|
2010-07-16 19:44:30 +08:00
|
|
|
string(0) ""
|
|
|
|
|
2011-12-19 10:05:03 +08:00
|
|
|
Notice: Uninitialized string offset: -1 in %sstr_offset_001.php on line %d
|
2010-07-16 19:44:30 +08:00
|
|
|
string(0) ""
|
|
|
|
string(1) "a"
|
|
|
|
string(1) "b"
|
|
|
|
string(1) "c"
|
|
|
|
|
2011-12-19 10:05:03 +08:00
|
|
|
Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line %d
|
2010-07-16 19:44:30 +08:00
|
|
|
string(0) ""
|
|
|
|
string(1) "b"
|
|
|
|
|
2011-12-19 10:05:03 +08:00
|
|
|
Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line %d
|
2010-07-16 19:44:30 +08:00
|
|
|
string(0) ""
|