Skip to content

Commit b7d067c

Browse files
committed
Add explode method
1 parent b6baaab commit b7d067c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Format/Arr.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ public function arrayKeys()
5757
return $this;
5858
}
5959

60+
/**
61+
* Will explode an array item value and then merge it into array in same hierky
62+
* @param string $separator
63+
* @param array $array
64+
* @return array
65+
*/
66+
public function arrayItemExpMerge(string $separator): self
67+
{
68+
$new = array();
69+
foreach ($this->value as $item) {
70+
$exp = explode($separator, $item);
71+
$new = array_merge($new, $exp);
72+
}
73+
$this->value = $new;
74+
return $this;
75+
}
6076

6177
public function shift(?Str &$shiftedValue = null): self
6278
{

0 commit comments

Comments
 (0)