Skip to content

Instantly share code, notes, and snippets.

View sandroneuhaus's full-sized avatar

Sandro José Neuhaus sandroneuhaus

View GitHub Profile
@rafael-neri
rafael-neri / validar_cpf.php
Last active April 27, 2024 21:49
Validar CPF em PHP (Completo)
<?php
function validaCPF($cpf) {
// Extrai somente os números
$cpf = preg_replace( '/[^0-9]/is', '', $cpf );
// Verifica se foi informado todos os digitos corretamente
if (strlen($cpf) != 11) {
return false;