src/CPF.php
public function validate($cpf)
    {
        $raw_cpf    = $cpf;
        $cpf        = $this->clean($cpf);
        $has_mask   = preg_match("/^[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}$/", $raw_cpf);

        if (!$has_mask && !is_numeric($raw_cpf)) {
            return false;
        }

        if (!$this->isLengthValid($cpf)) {
            return false;
        }

        elseif ($this->isDummyValue($cpf)) {
            return false;
        }

        return $this->validateDigits($cpf);
    }
public function validate($cpf)
    {
        $raw_cpf    = $cpf;
        $cpf        = $this->clean($cpf);
        $has_mask   = preg_match("/^[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}$/", $raw_cpf);

        if (!$has_mask && !is_numeric($raw_cpf)) {
            return false;
        }

        if (!$this->isLengthValid($cpf)) {
            return false;
        }

        elseif ($this->isDummyValue($cpf)) {
            return false;
        }

        return $this->validateDigits($cpf);
    }
public function validate ( $ cpf ) { $ raw_cpf = $ cpf ; $ cpf = $ this -> clean ( $ cpf ) ; $ has_mask = preg_match ( "/^[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}$/" , $ raw_cpf ) ; if ( ! $ has_mask && ! is_numeric ( $ raw_cpf ) ) { return false ; } if ( ! $ this -> isLengthValid ( $ cpf ) ) { return false ; } elseif ( $ this -> isDummyValue ( $ cpf ) ) { return false ; } return $ this -> validateDigits ( $ cpf ) ; }
Validate a given Brazilian CPF number

@param   $cpf
@return  bool
Validate a given Brazilian CPF number