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

Request Environment filtering

Hello Phalcon team <3

  • $id = $request->getPost('id', 'int');
  • OR
  • $id = $request->getQuery('id', 'int');
    • For example send post: 'NewYork'
    • Returns: empty string
    • For example send post: 'AER-#@SDS'
    • Returns: '-'
    • For example send post: '12-213'
    • Returns: '12-213'

Int filtering not removing " - " this symbol...

Who can explain this why?

sadasdasd



32.2k
Accepted
answer

hi @Soso int or !int filters remove all characters except digits, plus and minus sign and convert to int in !int case. If you want only get digits you have to create your own filter. Check this documentation

Good luck