@@ -56,6 +56,77 @@ The following functions are available:
5656.. note :: Prior to v4.2.0, ``dot_array_search('foo.bar.baz', ['foo' => ['bar' => 23]])`` returned ``23``
5757 due to a bug. v4.2.0 and later returns ``null ``.
5858
59+ .. php :function :: dot_array_has(string $search, array $values): bool
60+
61+ :param string $search: The dot-notation string describing how to search the array
62+ :param array $values: The array to check
63+ :returns: ``true `` if the key exists, otherwise ``false ``
64+ :rtype: bool
65+
66+ Checks if an array key exists using dot syntax.
67+ This method supports wildcard ``* `` in the same way as ``dot_array_search() ``.
68+
69+ .. literalinclude :: array_helper/015.php
70+ :lines: 2-
71+
72+ .. php :function :: dot_array_set(array &$array, string $search, mixed $value): void
73+
74+ :param array $array: The array to modify (passed by reference)
75+ :param string $search: The dot-notation string describing where to set the value
76+ :param mixed $value: The value to set
77+ :rtype: void
78+
79+ Sets an array value using dot syntax. Missing path segments are created automatically.
80+ Wildcard ``* `` is supported with the same rule as ``dot_array_has() ``:
81+ you must specify a key right after ``* ``.
82+
83+ .. literalinclude :: array_helper/016.php
84+ :lines: 2-
85+
86+ .. php :function :: dot_array_unset(array &$array, string $search): bool
87+
88+ :param array $array: The array to modify (passed by reference)
89+ :param string $search: The dot-notation string describing which key to remove
90+ :returns: ``true `` if a key was removed, otherwise ``false ``
91+ :rtype: bool
92+
93+ Removes array values using dot syntax.
94+ Wildcard ``* `` is supported.
95+ You can target specific keys like ``users.*.id `` or clear all keys under a path with ``user.* ``.
96+
97+ .. literalinclude :: array_helper/017.php
98+ :lines: 2-
99+
100+ .. php :function :: dot_array_only(array $array, array|string $indexes): array
101+
102+ :param array $array: The source array
103+ :param array|string $indexes: One key or a list of keys using dot notation
104+ :returns: Nested array containing only the requested keys
105+ :rtype: array
106+
107+ Gets only the specified keys using dot syntax while preserving nested structure.
108+
109+ Wildcard ``* `` is supported. Unlike ``dot_array_set() `` and ``dot_array_unset() ``,
110+ this method also allows wildcard at the end (for example ``user.* ``).
111+
112+ .. literalinclude :: array_helper/018.php
113+ :lines: 2-
114+
115+ .. php :function :: dot_array_except(array $array, array|string $indexes): array
116+
117+ :param array $array: The source array
118+ :param array|string $indexes: One key or a list of keys using dot notation
119+ :returns: Nested array with the specified keys removed
120+ :rtype: array
121+
122+ Gets all keys except the specified ones using dot syntax.
123+
124+ Wildcard ``* `` is supported. Unlike ``dot_array_set() `` and ``dot_array_unset() ``,
125+ this method also allows wildcard at the end (for example ``user.* ``).
126+
127+ .. literalinclude :: array_helper/019.php
128+ :lines: 2-
129+
59130.. php :function :: array_deep_search($key, array $array)
60131
61132 :param mixed $key: The target key
0 commit comments