本文整理汇总了PHP中Normalizer::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Normalizer::get方法的具体用法?PHP Normalizer::get怎么用?PHP Normalizer::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Normalizer
的用法示例。
在下文中一共展示了Normalizer::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: change
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());