- substr: documentation ( source)
- var_dump: documentation ( source)
- uniqid: documentation ( source)
- preg_replace: documentation ( source)
- strtolower: documentation ( source)
- range: documentation ( source)
<?php
$a = uniqid();
function getNumber($val) {
$lets = array();
foreach (range('a', 'z') as $let) {
$lets[] = ("'`" . $let . "`is'");
}
$nums = array();
foreach (range(1, 26) as $num) {
$nums[] = $num;
}
$val = strtolower($val);
//die(preg_replace('`asda`is', 123, 'this bullasda'));
$ret = preg_replace($lets, $nums, $val);
$ret = substr($ret, 0, 10);
return $ret;
}
$b = getNumber($a);
echo "<pre>";
var_dump($b);