uniqid random string

Here is a smaller implimentation of the built in uniqid() function.

Good if you want to generate smaller unique strings for url's

uniqid example


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;


20 random 5 length strings

Other Items in php
Related Search Terms
Page Views

This page has been viewed 334 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.