public function change($index, $value) { foreach ($this->records as $idx => $record) { $this->records[$idx][$index] = $value; } return $this; } public function setData($data) { $this->records = $data; return $this; } public function get() { return $this->records; } } $norm = new Normalizer([['id' => 1, 'first_name' => 'Daison', 'last_name' => 'Carino', 'age' => 24, 'address' => '#21 Malunggay St. Project 7, Quezon City, Pangasinan', 'is_married' => false], ['id' => 2, 'first_name' => 'Nissan Mae', 'last_name' => 'Dela Cruz', 'age' => 25, 'address' => 'Calobaoan, San Carlos Pangasinan', 'is_married' => false], ['id' => 3, 'first_name' => 'Daison Lancer', 'last_name' => 'Carino', 'age' => 6, 'address' => 'Calobaoan, San Carlos Pangasinan']]); $norm->filter('Daison', 'first_name', function ($A) use($norm) { $A->filter('Carino', 'last_name', function ($B) use($norm) { $B->removeIndex('id'); return $B; }); return $A; }); $norm->addIndex($new_key = 'gender', $after_key = 'age'); var_dump($norm->get()); exit; $norm->transform($indexes = ['is_married'], $pattern = [false => 'No', true => 'Yes']); $norm->reIndex($indexes = ['id' => 'ID', 'first_name' => 'First Name', 'last_name' => 'Last Name', 'age' => 'Age', 'gender' => 'Gender', 'address' => 'Address', 'is_married' => 'Married']); var_dump($norm->get());