Random string generator function in php suniqid

Here is a a smaller version of the built in php function uniqid() uses letters and numbers and specify the length of the random string.


public function suniqid($len = 5) {
		$seed = str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); // allowed characters
		shuffle($seed); // shuffle the array
		$rand = '';
		foreach (array_rand($seed, $len) as $x) $rand .= $seed[$x];
		return $rand;
Enter a number to change the Lenth of the random string.

Other Items in php
Page Views

This page has been viewed 217 times.

Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.


Random Quote
I'm a big believer in energy and the secret and that sort of thing.