We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Multiple filtering/sanitizing on field

How can i use multiple filter on field? Like that striptags and trim together:

    $this->request->getPost('title', 'striptags|trim');


93.7k
Accepted
answer

Try with array as second parameter:

$this->request->getPost('title', ['striptags', 'trim']);


58.1k
edited May '16

Try with array as second parameter:

$this->request->getPost('title', ['striptags', 'trim']);

Ooww, i missed that! Really thanks ;)

Array can also be passed to a filter component:

   $num = $this->filter->sanitize($num, ['int', 'alphanum']);