We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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']);


57.9k
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']);