Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$passwordLength = 15;
$capitalLetterPosition = rand(0, $passwordLength - 1);
$lowercaseLetterPosition = rand(0, $passwordLength - 1);
$password = null;
for ($i = 0; $i < $passwordLength; $i++) {
if ($i === $capitalLetterPosition) {
$password .= chr(rand(65,90));
}
if ($i === $lowercaseLetterPosition) {
$password .= chr(rand(97,122));
}
$password .= chr(rand(48, 57));
}
echo $password;