$count_pass = c("edit1")->text; if(c("checkbox1")->checked) { $end_small = 'abcdefghijklmnopqrstuvwxyz'; } if(c("checkbox2")->checked) { $symbols = '"^$#@?*-=_+'; } if(c("checkbox3")->checked) { $numbers = '1234567890'; } $all = $end_small.$symbols.$numbers; $count = iconv_strlen($end_small) + iconv_strlen($symbols) + iconv_strlen($numbers); for($x = 0; $x<$count_pass;$x++) { $pass .= $all[rand(0, $count)]; } c("MemoText")->text = $pass;