security->generateRandomString(8); $security = Yii::createObject("yii\base\Security"); $n = 0; for ($i = 1; $i < 100000; $i++) { //$key = $security->generateRandomString(8); $key = rand(10000000, 99999999); /*$key = strtolower($key); $key = str_replace(['_', '-'], 'a', $key);*/ $ret[$key] += 1; } $this->stdout("duplicate data:\n", Console::FG_RED); foreach ($ret as $k => $v) { if ($v > 1) { echo "$k $v\n"; } } } }