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

Validating Characters Using FILTER_VALIDATE_REGEXP

These are my codes, I want to validate and filter special characters entered by user, even they by pass it, the query wouldn't accept the entered data but it's not working it's always failing.

public function updateuserAction(){
        $get = $this->request;
        $key = $get->get('key');
        $email = $get->get('email');
        $password = $get->get('password');
        $realName = $get->get('realName');
        $type = $get->get('userType');
        if(filter_var($realname, FILTER_VALIDATE_REGEXP, array("options" => array("regexp" => "/^[a-zA-Z]+$/")))){
            $url = $this->apiUrl."user/update?q=(key:$key,email:".urlencode($email).",password:".urlencode($password).",realName:".urlencode($realName).",userType:".urlencode($type).")&envelope=false";
            $ch = curl_init($url);
            curl_setopt_array($ch, $this->curlopt);
            echo  curl_exec($ch);
     echo "failed";


There is a spell mistake: $realName = $get->get('realName'); if(filter_var($realname,