hello ,
i was trying to make function to insert into number small md5 hash to make it hard to read for special usage , so lets say i have number like "1234" , with my function it gonna be (1xx2xx3xx4xx) ==> x is md5 num
so i coded the function like that
PHP Code:
function code($num) {
$count = strlen($num);
$hash = substr(md5(rand(0,999)), 15, 2);
$start = "0";
while($count > 0) {
$cut = substr($num, $start, 1);
$all = $cut.$hash;
++$start;
--$count;
}
return $all ;
}
but it doesnt return with the full number, it returns with the last x number cazue of while , and if i added echo $all; between while tags it gonna print the all number like that
PHP Code:
$all = $cut.$hash;
echo $all;
++$start;
--$count;
so please how can i make the function returns with the full number $cut.$hash (1xx2xx3xx4xx) ??
thanks