After utilizing str_replace on an array - how to or best way to save the data.

I have a replace function that will take a subset list of e-mail users and replace the username.

[php]function replace()
{
var_dump($_POST[‘replace_user’]);
$mike = (unserialize(base64_decode($_POST [‘miketest’])));
foreach ($mike as $test)
$test[‘last_name’] = str_replace(“hhh”, “kkk”, $test[‘User’][‘last_name’]);
var_dump($test);
}[/php]

I can see the replace working but I’m wondering the best way to save the updates.
I tried multiple approaches
ex.
$this->User->save($test[‘last_name’]);
$this->User->save($this->data);
$this->User->save($this->$test);
I did look at the examples on the following page but I probably need additional clarification etc. to better understand the format. Thanks in advance for any assistance.

http://book.cakephp.org/2.0/en/models/saving-your-data.html

On the var_dump is the array 0

So would it be something like
[php]$this->User->save($test[‘0’][‘last_name’]);[/php]

maybe show the var_dump array as well or print_r($test)

Sponsor our Newsletter | Privacy Policy | Terms of Service