<?php
/**
* Make a random string, maybe use to transaction ID
* @param @length int length of result
* @param string $chars characters use for random
* @return string Random string
*/
function _airlineTicket($length=9, $chars=NULL)
{
if (NULL == $chars) {
// makes a random alpha numeric string of a given lenth
$chars = array_merge(range('A', 'Z'), range('a', 'z'),range(0, 9));
}
$out ='';
for($c=0;$c < $length;$c++) {
$out .= $chars[mt_rand(0,count($chars)-1)];
}
return strtoupper($out);
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.