@@ -15,17 +15,17 @@ There are two available classes with a different behaviour:
15
15
## MutableArray
16
16
17
17
Each functional method operate on the same array and return the same instance
18
- (DO NOT create a new instance) except only few methods starts with ` create ` prefix.
18
+ (** DO NOT** create a new instance) except only few methods starts with ` create ` prefix.
19
19
This way a bit improve performance and provide more convenience usage in OOP way.
20
20
21
21
> ** NOTE:** Check the [ CreateClone] ( #createclone ) section if you want to operate on new instance NOT on same instance.
22
22
23
23
## ImmutableArray
24
24
25
25
Each functional method operate on the same array but not modified it.
26
- Instead of this it return a new object (create a new instance)
26
+ Instead of this it return a new object (create a new instance).
27
27
This way a bit disimprove performance but give you the behaviour
28
- seems like most of built-in PHP functions that returns a new array (DO NOT modified input one).
28
+ seems like most of built-in PHP functions that returns a new array (** DO NOT** modified input one).
29
29
30
30
> ** NOTE:** If you don't need the first instance you operates on, you can override it manually:
31
31
@@ -140,9 +140,9 @@ use Arrayzy\ImmutableArray as ImArr; // MuArr and ImArr is the arbitrary aliases
140
140
Create a new empty object with the ` new ` statement using declared arbitrary namespace aliases above:
141
141
142
142
``` php
143
- $muArr = new MuArr; // Create new instance of MutableArray by namespace alias
143
+ $a = new MuArr; // Create new instance of MutableArray by namespace alias
144
144
// or
145
- $imArr = new ImArr; // Create new instance of ImmutableArray by namespace alias
145
+ $a = new ImArr; // Create new instance of ImmutableArray by namespace alias
146
146
```
147
147
148
148
or with default values, passed an array to the constructor:
@@ -416,6 +416,7 @@ $a = A::create(['a', 'b', 'c']);
416
416
$a->find(function($value, $key) {
417
417
return 'b' == $value && 0 < $key;
418
418
}); // 'b'
419
+ ```
419
420
420
421
### first
421
422
@@ -749,7 +750,7 @@ $a->toArray(); // [0 => 'a', 1 => 'b', 3 => 'c']
749
750
### unshift
750
751
751
752
``` php
752
- $a = A::create([( 'a', 'b']);
753
+ $a = A::create(['a', 'b']);
753
754
$a->unshift('y', 'z');
754
755
$a->toArray(); // [0 => 'y', 1 => 'z', 2 => 'a', 3 => 'b']
755
756
```
@@ -760,7 +761,7 @@ $a->toArray(); // [0 => 'y', 1 => 'z', 2 => 'a', 3 => 'b']
760
761
761
762
``` php
762
763
$a = A::create(['a', 'b', 'c']);
763
- $a->walk(function(& $value, $key) { //
764
+ $a->walk(function(& $value, $key) {
764
765
$key++; // the $key variable passed by value, (original value will not modified)
765
766
$value = $value . $key; // the $value variable passed by reference (modify original value)
766
767
});
0 commit comments