- explode: documentation ( source)
- strrev: documentation ( source)
- array_diff: documentation ( source)
- str_split: documentation ( source)
<?php
$str = 'a1b2c3 abc123';
$part = explode(' ', $str);
$reverted = strrev($part[1]);
$arr1 = str_split($part[1]);
$arr2 = str_split($part[0]);
if(count(array_diff($arr1, $arr2))){
echo "NO";
}
else{
echo "YES";
}