既存の配列を削除するにはどうすればよいですか (以下のコードを参照)? CodeIgniter が優れたフレームワークであることは知っていますが、CI が $this->data メソッドをどのように管理しているかを知りたいです。
私のコード:
<?php
class simple {
public $data;
public function set($key, $value)
{
$this->data[$key] = $value;
}
}
class testa extends simple {
function yoop()
{
$this->set('name', 'excelent');
echo '<pre>'.print_r($this->data, TRUE).'</pre>';
}
function noop()
{
$this->set('level', 'normal');
$this->set('power', 'high');
echo '<pre>'.print_r($this->data, TRUE).'</pre>';
}
}
$testa = new testa;
$testa->yoop();
$testa->noop();
/* EOF */
現在の結果:
Array
(
[name] => excelent
)
Array
(
[name] => excelent
[level] => normal
[power] => high
)
既存の配列を削除したいのですが、最終的な結果は次のとおりです。
Array
(
[name] => excelent
)
Array
(
[level] => normal
[power] => high
)