summaryrefslogtreecommitdiff
path: root/Zend/tests/str_offset_001.phpt
blob: 3317674857026e260025486391675739d1a09ebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
string offset 001
--FILE--
<?php
// Test positive or null string offsets

function foo($x) {
	var_dump($x);
}

$str = "abc";
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[0]);
foo($str[1]);
foo($str[2]);
foo($str[3]);
foo($str[1][0]);
foo($str[2][1]);
?>
--EXPECTF--
string(1) "a"
string(1) "b"
string(1) "c"

Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line %d
string(0) ""
string(1) "b"

Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line %d
string(0) ""
string(1) "a"
string(1) "b"
string(1) "c"

Notice: Uninitialized string offset: 3 in %sstr_offset_001.php on line %d
string(0) ""
string(1) "b"

Notice: Uninitialized string offset: 1 in %sstr_offset_001.php on line %d
string(0) ""