Try this: Does that work for you? Not sure if str_replace() does all the replacements simultaneously or one-after-one, though...
Well... there's a way I can think of, but it's not clean and it's not "pretty" $str=str_replace(array(')','('),array('V67ggbvoA','vfUtFiuF6'),$str); $str=strrev($str); $str=str_replace(array(strrev('V67ggbvoA'),strrev('vfUtFiuF6')),array(')','('),$str); PHP: This was just an illustration of what I thought. Of course, you might need to change it to fit your needs.
Just random strings You can put whatever you want in there, just make sure it's not something found on the original string.
you can maybe do something like: $string = "(My String)"; $string = str_replace("(","_(_",$string); $string = str_replace(")","_)_",$string); $string = strrev($string); $string = str_replace("_(_",")",$string); $string = str_replace("_)_","(",$string); PHP:
nope, no luck. both methods still continue to flip the brackets i'm going to raise the stakes and offer the first person with a working method a $45 google adwords voucher!
Try using this function instead, you can add more cases for all different brackets function reverse($var){ $len=strlen($var)-1; for($i=$len; $i>=0; $i--){ switch ($var[$i]){ case "(": $var[$i]=")"; break; case ")": $var[$i]="("; break; }//endswitch $rvar.=$var[$i]; }//end for return $rvar; }//end function PHP: