function formatCnpjCpf($value)
{
$CPF_LENGTH = 11;
$cnpj_cpf = preg_replace("/\D/", '', $value);
if (strlen($cnpj_cpf) === $CPF_LENGTH) {
return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function seconds_to_time($seconds) | |
{ | |
$normalized = (int) ($seconds ?? 0); | |
if ($normalized === 0) { | |
return '00:00:00'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PARA GERAR UM NUMERO ALEATÓRIO NO SQL | |
-- ALEATORIO: (ALEATORIO() * (MAX - MIN + 1)) + MIN | |
-- exemplo de chamada | |
SELECT FLOOR((RAND() * (100-50+1)) + 50) AS ALEATORIO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove specific file from git cache | |
git rm --cached filename | |
# remove all files from git cache | |
git rm -r --cached . | |
git add . | |
git commit -m ".gitignore is now working" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$var = print "Variable"; | |
?> | |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> |
OlderNewer