If it was just to test the performance of "strpos" under -O4 => copy the code, and compile the copy with O4
to find a real difference you need to feed enough Test Data into the Algorithm
like explained in the documentation
https://en.wikipedia.org/wiki/Brute-force_searchWhile a brute-force search is simple to implement, and will always find a solution if it exists, its cost is proportional to the number of candidate solutions – which in many practical problems tends to grow very quickly as the size of the problem increases (§Combinatorial explosion).
on little data you won't find a difference.
but as the documentation explains the solution is not
scalableThe best way to feed enough data into the Algorithm like in a
Real-World Production Tool is with a file.
But still any improvements on the code are welcomed.