| Don’t use strlen() - WP Engineer | Don’t use strlen() - WP Engineer | Each time I see someone use strlen() I cringe. It will break. Despite its name, strlen() doesn’t count characters. It counts bytes. In UTF-8 a character may be up to four bytes long. So what happens if we use strlen() and its companion substr() to shorten the title of post? ...

shoeb's picture

thanks boss for the useful share. i had no idea strlen counts bytes :(

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.