function isRotation($s1, $s2) {
return (strlen($s1) == strlen($s2) && (strpos($s1.$s1, $s2) !== false));
}
$s1 = "abbc";
$s2 = "cabb";
echo isRotation($s1, $s2) ? "yes" : "no";
echo "<br />";
$s1 = "abbc";
$s2 = "bbac";
echo isRotation($s1, $s2) ? "yes" : "no";
/*
run:
yes
no
*/