Example 1 — Find a Letter After an Accent
Compare the character position with the byte position.
<?php
$text = "Héllo Wörld";
echo strpos($text, "ö"), PHP_EOL;
echo iconv_strpos($text, "ö", 0, "UTF-8"), PHP_EOL; How It Works
- Search for
ö. It comes after the accentedé. - strpos() counts bytes. The
étakes 2, so the result is 8. - iconv_strpos() counts characters. The result is 7.
- Use the character version for text with accents.

