I'm looking for a way to rotate a string to the left N times. Here are some examples:
Let the string be abcdef
1
time I want
bcdefa
2
time I want
cdefab
3
time I want
defabc
$rotated = substr($str, $n) . substr($str, 0, $n);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With