Alex Rivera | Logout

PHP random URL names (short URL)

Asked 2011-03-24T16:05:06.963
9

After using sites like JSFiddle I noticed that they auto generate a random and unique URL made up of various upper and lower case characters.

We could benefit from this for our booking pages. How is it done?

Edit
Report

1 Answer

0

You could simply create an array of all potential characters then randomly pick out however many you want and return them as the URL "code"?

$arr = array('a','b','c','d');
$count = count($arr) - 1;
$str = $arr[rand(0, $coun)].$arr[rand(0, $coun)];
answered 2011-03-24T16:07:58.037

Your Answer