Skip to content

Commit

Permalink
README fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Mar 16, 2024
1 parent d6f5daa commit 4f2600c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ use Smoren\ArrayView\Views\ArrayView;
$originalArray = [1, 2, 3, 4, 5];
$view = ArrayView::toView($originalArray);

$view->subview(new MaskSelector([true, false, true, false, true])).toArray(); // [1, 3, 5]
$view->subview(new IndexListSelector([1, 2, 4])).toArray(); // [2, 3, 5]
$view->subview(new SliceSelector('::-1')).toArray(); // [5, 4, 3, 2, 1]
$view->subview(new MaskSelector([true, false, true, false, true]))->toArray(); // [1, 3, 5]
$view->subview(new IndexListSelector([1, 2, 4]))->toArray(); // [2, 3, 5]
$view->subview(new SliceSelector('::-1'))->toArray(); // [5, 4, 3, 2, 1]

$view->subview([true, false, true, false, true]).toArray(); // [1, 3, 5]
$view->subview([1, 2, 4]).toArray(); // [2, 3, 5]
$view->subview('::-1').toArray(); // [5, 4, 3, 2, 1]
$view->subview([true, false, true, false, true])->toArray(); // [1, 3, 5]
$view->subview([1, 2, 4])->toArray(); // [2, 3, 5]
$view->subview('::-1')->toArray(); // [5, 4, 3, 2, 1]

$view->subview(new MaskSelector([true, false, true, false, true])).apply(fn ($x) => x * 10);
$view->subview(new MaskSelector([true, false, true, false, true]))->apply(fn ($x) => x * 10);
print_r($originalArray); // [10, 2, 30, 4, 50]
```

Expand Down

0 comments on commit 4f2600c

Please sign in to comment.