- 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) {
$i = 0;
$key = removeExtraCharacters($key);
$str = $data."";
$rtn = "";
while ($i < strlen($str)) {
$char = $str[$i];
echo $char." - ".intval($char)."\n";
$rtn .= substr($key,intval($char),1);
$i++;
}
return $rtn;
}
echo saveDataFormatMessage(985651278,md5(""))."\n";