greeting, i tried to reverse alphabet without affect special character. i tried something but its not work. i hope anyone help me to figure out the mistake. thanks in advance.
<?php
function Remove($val){
$r = strlen($val)-1;
$j = 0;
$pattern ='/[\'\/~`\!@#\$%\^&\*\(\)_\-\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/';
while($j < $r){
if(preg_match($pattern,$val[$j])){
$j++;
}
else if(preg_match($pattern,$val[$r])){
$r--;
}else{
$j++;
$r--;
list($val[$j],$val[$r]) = array($val[$j],$val[$r]);
}
}
}
$val = "<brinh!>";
echo(Remove($val));
?>