3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function random_password(int $min, int $max) { $allowed = array_merge( [33, 60, 62, 94, 95], range(48, 57), range(64, 90), range(97, 122) ); $length = random_int($min, $max); $chars = []; for ($i = 0; $i < $length; $i++) { $bi = random_int(0, count($allowed)-1); $chars[] = chr($allowed[$bi]); } return implode('', $chars); } var_dump(random_password(8, 12));
based on eOVZk
Output for 7.3.0rc3
string(11) "zITV0nGXYxb"
Output for 7.3.0rc2
string(12) "0d0!68lfkFj1"
Output for 7.3.0rc1
string(11) "duvHseldIrt"
Output for 7.3.0beta3
string(12) "L<ux>iY5oe4R"
Output for 7.3.0beta2
string(11) "!w2ZGerFs0P"
Output for 7.3.0beta1
string(10) "<jU!XYefO!"
Output for 7.3.0alpha4
string(11) "Pp8P!8qxg3<"
Output for 7.3.0alpha3
string(8) "hK<LXDvy"
Output for 7.3.0alpha2
string(12) "@HDLzIcNjgp9"
Output for 7.3.0alpha1
string(9) "<GwY<xYXH"
Output for 7.2.11
string(8) "m^8H8d8q"
Output for 7.2.10
string(12) "csMg2MrBbJu1"
Output for 7.2.9
string(11) "NiC7hTDwLow"
Output for 7.2.8
string(12) "63@nKSN7KBvW"
Output for 7.2.7
string(10) "!F6RT<bH>q"
Output for 7.2.6
string(9) "tz>^CV@GL"
Output for 7.2.5
string(9) "sf3jd1aDO"
Output for 7.2.4
string(8) "3>juCPFX"
Output for 7.2.3
string(9) "jEJiKmcot"
Output for 7.2.2
string(9) "nshGv@atB"
Output for 7.2.1
string(9) "Jo6EEpyK>"
Output for 7.2.0
string(8) "jzrM>fQ8"
Output for 7.1.23
string(10) "jnUWW_H26b"
Output for 7.1.22
string(11) "FeYA3ySGYzB"
Output for 7.1.21
string(11) "387xEvL85Bg"
Output for 7.1.20
string(8) "6oN1b8uZ"
Output for 7.1.19
string(12) "7xhXH03DUd@y"
Output for 7.1.18
string(12) "gX0J4Hk7ClmK"
Output for 7.1.17
string(8) "^5cW5edm"
Output for 7.1.16
string(9) "_AhdkDAW2"
Output for 7.1.15
string(11) "rIQeInU5@xY"
Output for 7.1.14
string(11) "iq!!Hiq45_8"
Output for 7.1.13
string(12) "o6@3s^KaEqG_"
Output for 7.1.12
string(9) "gLSBQ1a09"
Output for 7.1.11
string(9) "plIV_XO3J"
Output for 7.1.10
string(8) "9XGj4WxS"
Output for 7.1.9
string(10) "jwp!YpW@k5"
Output for 7.1.8
string(12) "oMLRI<oYA^OO"
Output for 7.1.7
string(10) "2nSU64nerH"
Output for 7.1.6
string(9) "7s0PaQhfB"
Output for 7.1.5
string(8) "q<Ka>PM5"
Output for 7.1.4
string(11) "VfQohh8g9OM"
Output for 7.1.3
string(12) "Cb>DtuKunhy2"
Output for 7.1.2
string(8) "fe8c_fm5"
Output for 7.1.1
string(9) "K1BPNFQl>"
Output for 7.1.0
string(8) "c3WGQNZT"
Output for 7.0.28
string(8) "0PoXzNXq"
Output for 5.6.38
Catchable fatal error: Argument 1 passed to random_password() must be an instance of int, integer given, called in /in/thjqC on line 24 and defined in /in/thjqC on line 3
Process exited with code 255.