Skip to content

Instantly share code, notes, and snippets.

@csalgueiro
Created January 10, 2014 13:14
Show Gist options
  • Select an option

  • Save csalgueiro/8351737 to your computer and use it in GitHub Desktop.

Select an option

Save csalgueiro/8351737 to your computer and use it in GitHub Desktop.
Funcion para generar aleatoriamente matriculas europeas
function generateMatricula() {
$numbers = '0123456789';
$characters = 'BCDFGHIJKLMNPQRSTVWXYZ';
$randomString = '';
for ($i = 0; $i < 4; $i++) {
$randomString .= $numbers[rand(0, strlen($numbers) - 1)];
}
for ($i = 0; $i < 3; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment