How can you match the following words by PHP, either by regex/globbing/…?
Examples
INNO, heppeh, isi, pekkep, dadad, mum
My attempt would be to make a regex which has 3 parts:
- 1st match match [a-zA-Z]*
- [a-zA-Z]?
- rotation of the 1st match // Problem here!
The part 3 is the problem, since I do not know how to rotate the match.
This suggests me that regex is not the best solution here, since it is too very inefficient for long words.
I think regex are a bad solution. I’d do something with the condition like:
($word == strrev($word)).