function rotations($str1, $str2) {
if (strlen($str1) != strlen($str2)) {
return false;
}
echo $str1 . $str1 . "\n";
return strpos($str1 . $str1, $str2) !== false;
}
$str1 = "abcxd";
$str2 = "cxdab";
if (rotations($str1, $str2)) {
echo "yes";
}
else {
echo "no";
}
/*
run:
abcxdabcxd
yes
*/