- <?php
-
-
-
- namespace common\helpers;
-
- class Password {
-
- public static function generate($length = 6)
- {
- $chaine = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789' ;
- $nb = strlen($chaine) - 1;
- $code = '';
- for($i=0; $i < $length; $i++)
- {
- $pos = mt_rand(0, $nb);
- $car = $chaine[$pos];
- $code .= $car;
- }
-
- return $code ;
- }
-
- }
|