random() public static méthode

Generate ridable random string
public static random ( integer $length = 10, boolean $isReadable = true ) : string
$length integer
$isReadable boolean
Résultat string
Exemple #1
0
 /**
  * @param $file
  * @return array
  */
 public function uploadScreenShot3($file)
 {
     $name = Str::random() . '.' . strtolower($file->ext);
     $image = new Image($file->image);
     $image->saveAs(PATH_PUBLIC . '/images/' . $name, 100);
     return array('UploadScreenShot3Result' => $image->getUrl());
 }
Exemple #2
0
 public function testRandom()
 {
     is(10, strlen(Str::random()));
     is(10, strlen(Str::random(10)));
     is(10, strlen(Str::random(10, true)));
     is(10, strlen(Str::random(10, false)));
     isNotSame(Str::random(), Str::random());
     isNotSame(Str::random(), Str::random());
     isNotSame(Str::random(), Str::random());
 }