In this example i am going to show you how to create unique id or Index number in PHP.
<?php
function setindex_prefix($index_assigned)
{
switch(strlen($index_assigned))
{
case 1:
$new_index_assigned = "000".$index_assigned;
break;
case 2:
$new_index_assigned = "00".$index_assigned;
break;
case 3:
$new_index_assigned = "0".$index_assigned;
break;
default:
$new_index_assigned = $index_assigned;
}
return "NTRALMN".$new_index_assigned;
}
$unique_id=setindex_prefix($any_number);/* Pass parameter */
echo $unique_id;
?>