3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function GeneratePassword($length, $chars) { $str = ''; for($i = 0; $i < $length; $i++) { $str .= $chars[rand(0, strlen($chars) - 1)]; } return $str; } var_dump(GeneratePassword(5, 'abcdefghijklmno'));
Output for 7.2.0
string(5) "mnjbm"
Output for 7.1.7
string(5) "kaneo"
Output for 7.1.6
string(5) "mmnfm"
Output for 7.1.5
string(5) "ofbdj"
Output for 7.1.0
string(5) "lbgij"
Output for 7.0.20
string(5) "gcoco"
Output for 7.0.14
string(5) "bofhg"
Output for 7.0.12
string(5) "ijimm"
Output for 7.0.6
string(5) "gfago"
Output for 7.0.5
string(5) "eoinh"
Output for 7.0.4
string(5) "glked"
Output for 7.0.3
string(5) "kkogc"
Output for 7.0.2
string(5) "mjkfh"
Output for 7.0.1
string(5) "djkln"
Output for 7.0.0
string(5) "icncd"
Output for 5.6.28
string(5) "loeel"
Output for 5.6.21
string(5) "dhaih"
Output for 5.6.20
string(5) "mjdmf"
Output for 5.6.19
string(5) "ebadk"
Output for 5.6.18
string(5) "iblif"
Output for 5.6.17
string(5) "lfikf"
Output for 5.6.16
string(5) "gahib"
Output for 5.6.15
string(5) "khcbc"
Output for 5.6.14
string(5) "lffmm"
Output for 5.6.13
string(5) "heham"
Output for 5.6.12
string(5) "efdag"
Output for 5.6.11
string(5) "fiamm"
Output for 5.6.10
string(5) "kcofc"
Output for 5.6.9
string(5) "fcnhg"
Output for 5.6.8
string(5) "kiegm"
Output for 5.6.7
string(5) "gokhm"
Output for 5.5.35
string(5) "hkhgi"
Output for 5.5.34
string(5) "jkfmf"
Output for 5.5.33
string(5) "dnega"
Output for 5.5.32
string(5) "bkioe"
Output for 5.5.31
string(5) "adaik"
Output for 5.5.30
string(5) "kmnbe"
Output for 5.5.29
string(5) "ikfbf"
Output for 5.5.28
string(5) "cigle"
Output for 5.5.27
string(5) "nnlda"
Output for 5.5.26
string(5) "dkola"
Output for 5.5.25
string(5) "domoo"
Output for 5.5.24
string(5) "dekib"
Output for 5.4.45
string(5) "dnnga"
Output for 5.4.44
string(5) "bhacn"
Output for 5.4.43
string(5) "jfeia"
Output for 5.4.42
string(5) "ajioe"
Output for 5.4.41
string(5) "ojkdj"
Output for 5.4.40
string(5) "dokjo"
Output for 5.4.39
string(5) "ikmag"
Output for 5.4.38
string(5) "dadnk"
Output for 5.4.37
string(5) "kecnb"
Output for 5.4.36
string(5) "jodod"
Output for 5.4.35
string(5) "kgnnd"
Output for 5.4.34
string(5) "andag"
Output for 5.4.32
string(5) "ibgbf"
Output for 5.4.31
string(5) "fjbee"
Output for 5.4.30
string(5) "ajlac"
Output for 5.4.29
string(5) "klcmn"
Output for 5.4.28
string(5) "kibkf"
Output for 5.4.27
string(5) "fdlme"
Output for 5.4.26
string(5) "lgfka"
Output for 5.4.25
string(5) "ecnnc"
Output for 5.4.24
string(5) "jjaoa"
Output for 5.4.23
string(5) "agfla"
Output for 5.4.22
string(5) "lfhei"
Output for 5.4.21
string(5) "gcemi"
Output for 5.4.20
string(5) "dnlah"
Output for 5.4.19
string(5) "iaoib"
Output for 5.4.18
string(5) "liaec"
Output for 5.4.17
string(5) "ailki"
Output for 5.4.16
string(5) "oijkj"
Output for 5.4.15
string(5) "egmfo"
Output for 5.4.14
string(5) "gafhl"
Output for 5.4.13
string(5) "jlmnb"
Output for 5.4.12
string(5) "gegch"
Output for 5.4.11
string(5) "fgaio"
Output for 5.4.10
string(5) "hblie"
Output for 5.4.9
string(5) "camlb"
Output for 5.4.8
string(5) "lfela"
Output for 5.4.7
string(5) "ffhhj"
Output for 5.4.6
string(5) "mocoe"
Output for 5.4.5
string(5) "mogee"
Output for 5.4.4
string(5) "cnlbj"
Output for 5.4.3
string(5) "lgden"
Output for 5.4.2
string(5) "edlnc"
Output for 5.4.1
string(5) "adioj"
Output for 5.4.0
string(5) "mbmdb"
Output for 5.3.29
string(5) "hflmh"
Output for 5.3.28
string(5) "aihgn"
Output for 5.3.27
string(5) "jfagh"
Output for 5.3.26
string(5) "oefce"
Output for 5.3.25
string(5) "mmfal"
Output for 5.3.24
string(5) "cjbhl"
Output for 5.3.23
string(5) "akljb"
Output for 5.3.22
string(5) "giaci"
Output for 5.3.21
string(5) "jhifd"
Output for 5.3.20
string(5) "fjkmg"
Output for 5.3.19
string(5) "bghik"
Output for 5.3.18
string(5) "hkeja"
Output for 5.3.17
string(5) "dchde"
Output for 5.3.16
string(5) "amncc"
Output for 5.3.15
string(5) "inmki"
Output for 5.3.14
string(5) "jhgdo"
Output for 5.3.13
string(5) "jlemd"
Output for 5.3.12
string(5) "khcni"
Output for 5.3.11
string(5) "fgmen"
Output for 5.3.10
string(5) "dlafc"
Output for 5.3.9
string(5) "okdlh"
Output for 5.3.8
string(5) "dfcii"
Output for 5.3.7
string(5) "nadgk"
Output for 5.3.6
string(5) "nhjdm"
Output for 5.3.5
string(5) "hfmji"
Output for 5.3.4
string(5) "kaejl"
Output for 5.3.3
string(5) "ijocn"
Output for 5.3.2
string(5) "hdobi"
Output for 5.3.1
string(5) "aigch"
Output for 5.3.0
string(5) "algmm"
Output for 5.2.17
string(5) "mcddm"
Output for 5.2.16
string(5) "eljjl"
Output for 5.2.15
string(5) "jolge"
Output for 5.2.14
string(5) "lcjac"
Output for 5.2.13
string(5) "ifajm"
Output for 5.2.12
string(5) "acggb"
Output for 5.2.11
string(5) "mlkkk"
Output for 5.2.10
string(5) "acmfh"
Output for 5.2.9
string(5) "mggba"
Output for 5.2.8
string(5) "nbmeg"
Output for 5.2.7
string(5) "kigjf"
Output for 5.2.6
string(5) "bjkee"
Output for 5.2.5
string(5) "cjiad"
Output for 5.2.4
string(5) "jmnja"
Output for 5.2.3
string(5) "bhhdi"
Output for 5.2.2
string(5) "cbijb"
Output for 5.2.1
string(5) "cckjf"
Output for 5.2.0
string(5) "bbdke"
Output for 5.1.6
string(5) "bglel"
Output for 5.1.5
string(5) "lfmca"
Output for 5.1.4
string(5) "flffk"
Output for 5.1.3
string(5) "dglfl"
Output for 5.1.2
string(5) "cafkj"
Output for 5.1.1
string(5) "lojie"
Output for 5.1.0
string(5) "enhbo"
Output for 5.0.5
string(5) "ckeja"
Output for 5.0.4
string(5) "bhini"
Output for 5.0.3
string(5) "fnkam"
Output for 5.0.2
string(5) "kkmkd"
Output for 5.0.1
string(5) "hkell"
Output for 5.0.0
string(5) "eajmh"
Output for 4.4.9
string(5) "kcfnm"
Output for 4.4.8
string(5) "ajdli"
Output for 4.4.7
string(5) "nonnj"
Output for 4.4.6
string(5) "menln"
Output for 4.4.5
string(5) "cfgma"
Output for 4.4.4
string(5) "lmfdc"
Output for 4.4.3
string(5) "oddno"
Output for 4.4.2
string(5) "figfk"
Output for 4.4.1
string(5) "ecade"
Output for 4.4.0
string(5) "nonao"
Output for 4.3.11
string(5) "gdoam"
Output for 4.3.10
string(5) "cljej"
Output for 4.3.9
string(5) "bcjkj"
Output for 4.3.8
string(5) "lmnjd"
Output for 4.3.7
string(5) "baddn"
Output for 4.3.6
string(5) "fgkac"
Output for 4.3.5
string(5) "ononj"
Output for 4.3.4
string(5) "elcao"
Output for 4.3.3
string(5) "lhglf"
Output for 4.3.2
string(5) "dobla"
Output for 4.3.1
string(5) "lnege"
Output for 4.3.0
string(5) "hejla"