Skip to content

Commit

Permalink
More examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Mar 16, 2024
1 parent 8a60410 commit d6f5daa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ $view['::-1']; // [9, 8, 7, 6, 5, 4, 3, 2, 1]

$view[2]; // 3
$view[4]; // 5
$view[-1]; // 9
$view[-2]; // 8

$view['1:7:2'] = [22, 44, 66];
print_r($view); // [1, 22, 3, 44, 5, 66, 7, 8, 9]
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/Examples/ExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public function testSlicing()

$this->assertSame(3, $originalView[2]);
$this->assertSame(5, $originalView[4]);
$this->assertSame(9, $originalView[-1]);
$this->assertSame(8, $originalView[-2]);

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

0 comments on commit d6f5daa

Please sign in to comment.