Skip to content

Commit d6f5daa

Browse files
committed
More examples.
1 parent 8a60410 commit d6f5daa

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ $view['::-1']; // [9, 8, 7, 6, 5, 4, 3, 2, 1]
3838

3939
$view[2]; // 3
4040
$view[4]; // 5
41+
$view[-1]; // 9
42+
$view[-2]; // 8
4143

4244
$view['1:7:2'] = [22, 44, 66];
4345
print_r($view); // [1, 22, 3, 44, 5, 66, 7, 8, 9]

tests/unit/Examples/ExamplesTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public function testSlicing()
2222

2323
$this->assertSame(3, $originalView[2]);
2424
$this->assertSame(5, $originalView[4]);
25+
$this->assertSame(9, $originalView[-1]);
26+
$this->assertSame(8, $originalView[-2]);
2527

2628
$originalView['1:7:2'] = [22, 44, 66];
2729
$this->assertSame([1, 22, 3, 44, 5, 66, 7, 8, 9], $originalArray);

0 commit comments

Comments
 (0)