- array_map: documentation ( source)
- str_split: documentation ( source)
<?php
$string = "abcdefghijklmnopqrstuvwxyz"; // just used as an example
// $string becomes "badcfehgjilknmporqtsvuxwzy"
$now_in_pairs = str_split($string, 2);
$reverse = array_map('strrev', $now_in_pairs);
foreach($reverse as $r) {
$new_string .= $r;
}
echo $new_string;