@@ -14,13 +14,13 @@ as if it were an `array`.
14
14
There are three ways to create a ` Dots ` :
15
15
``` php
16
16
// Create an empty dot array
17
- $dot = new \MadeSimple\Dots();
17
+ $dots = new \MadeSimple\Dots();
18
18
19
19
// Create a dot array with a pre-existing array
20
- $dot = new \MadeSimple\Dots($array);
20
+ $dots = new \MadeSimple\Dots($array);
21
21
22
22
// Create a dot array with
23
- $dot = new \MadeSimple\Dots([
23
+ $dots = new \MadeSimple\Dots([
24
24
'address' => [
25
25
'houseNo' => '123',
26
26
'street' => 'Fake St',
@@ -39,30 +39,30 @@ in the following ways:
39
39
``` php
40
40
// Set an array after dot array
41
41
// Changes will _not_ be reflected in the original array
42
- $dot ->setArray($array);
42
+ $dots ->setArray($array);
43
43
44
44
// Set an array as a reference
45
45
// Changes will be reflected in the original array
46
- $dot ->setReference($array);
46
+ $dots ->setReference($array);
47
47
```
48
48
49
49
Basic usage of ` Dots ` :
50
50
``` php
51
51
// Get a value using dot notation:
52
- echo "Post Code: ", $dot ['address.postCode'], PHP_EOL;
52
+ echo "Post Code: ", $dots ['address.postCode'], PHP_EOL;
53
53
54
54
// Set a value using dot notation:
55
- $dot ['address.postCode'] = 'EF45 6GH';
56
- echo "Post Code: ", $dot ['address.postCode'], PHP_EOL;
55
+ $dots ['address.postCode'] = 'EF45 6GH';
56
+ echo "Post Code: ", $dots ['address.postCode'], PHP_EOL;
57
57
58
58
// Remove a value using dot notation:
59
- unset($dot ['address.postCode']);
60
- echo "Exists: ", (isset($dot ['address.postCode']) ? 'yes' : 'no'), PHP_EOL;
59
+ unset($dots ['address.postCode']);
60
+ echo "Exists: ", (isset($dots ['address.postCode']) ? 'yes' : 'no'), PHP_EOL;
61
61
62
62
// Add a value using dot notation:
63
- $dot ['address.postCode'] = 'IJ78 9KL';
64
- echo "Post Code: ", $dot ['address.postCode'], PHP_EOL;
63
+ $dots ['address.postCode'] = 'IJ78 9KL';
64
+ echo "Post Code: ", $dots ['address.postCode'], PHP_EOL;
65
65
66
66
// Access nth element in an sub array
67
- echo "Comment: ", $dot ['comments.1'], PHP_EOL;
67
+ echo "Comment: ", $dots ['comments.1'], PHP_EOL;
68
68
```
0 commit comments