Skip to content

Instantly share code, notes, and snippets.

@leonirlopes
Created April 20, 2018 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonirlopes/e7944585c36d4483fa30ee4e48be77d2 to your computer and use it in GitHub Desktop.
Save leonirlopes/e7944585c36d4483fa30ee4e48be77d2 to your computer and use it in GitHub Desktop.
Senha do Dia
<?php
// veja em funcionamento ~~> https://ideone.com/IMDNHT
// defino a data de hoje
$ano = date('Y');
$mes = date('m');
$dia = date('d');
// calculo uma senha de 6 digítos com base na data
$senha = substr((substr($ano, -2) * $mes * $dia * ($ano - 1900) * 6666), -6);
echo $senha;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment