- substr: documentation ( source)
- strpos: documentation ( source)
- md5: documentation ( source)
<?php
function removeExtraCharacters($key) {
$str = "";
$i = 0;
while ($i < strlen($key)) {
if (strpos($str, $key[$i]) === false) { $str .= $key[$i]; }
$i++;
}
return $str;
}
function saveDataFormatMessage($data,$key) {
$j = 0;
$key = removeExtraCharacters($key);
$str = $data."";
$rtn = "";
while ($j < strlen($str)) {
$rtn .= substr($key,$str[$j],1);
$j++;
}
return $rtn;
}
function showDataValueMessage($data,$key) {
$j = 0;
$key = removeExtraCharacters($key);
$rtn = "";
while ($j < strlen($data)) {
$rtn .= strpos($key,$data[$j])."";
$j++;
}
return $rtn;
}
echo saveDataFormatMessage(985,md5(""))."\n";
echo showDataValueMessage("2b9f081d",md5(""));