Voting

: one plus two?
(Example: nine)

The Note You're Voting On

el_porno at web dot de
20 years ago
You want to get rid of the whitespaces users add in your form fields...?
Simply use...:

class SomeVeryImportantClass
{
...
public function mungeFormData(&$data)
{
array_walk($data, array($this, 'munge'));
}

private function munge(&$value, &$key)
{
if(is_array($value))
{
$this->mungeFormData($value);
}
else
{
$value = trim($value);
}
}
...
}

so...
$obj = new SomeVeryImportantClass;
$obj->mungeFormData($_POST);
___
eNc

<< Back to user notes page

To Top