I am trying to replace every A-Z,a-z character to the 13th character from their index. The code above should output Aqeai4pyh_w
.
echo 'j_ulc4vnrdN
';
$string = "j_ulc4vnrdN";
$arr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$arr2 = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm';
$l = array();
$arr1 = str_split($arr);
$arr22 = str_split($arr2);
print_r($arr1);
print_r($arr22);
foreach(str_split($string) as $k){
echo $k.'
';
$k = str_replace($arr1,$arr22,$k);
echo $k.'
';
$l[] = $k;
// print_r($l);
}
echo strrev(implode('',$l));
But it outputs Adeai4clh_j
Anyone has any idea how is this happening?