public function update(array $search, array $update) { $filter = Matcher::factory($search); $this->jsonData = array_map(function ($item) use($filter, $update) { if ($filter->match($item)) { //item matches the filter foreach ($update as $updateKey => $updateValue) { $item[$updateKey] = $updateValue; } } return $item; }, $this->jsonData); }