Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8998043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:58:17+00:00 2026-06-15T23:58:17+00:00

Yes: I know. We should use mb_* function when we’re working with multibyte char.

  • 0

Yes: I know. We should use mb_* function when we’re working with multibyte char. But when we’re using strpos?
Let’s take a look this code (saved in utf-8)

var_dump(strpos("My symbol utf-8 is the €.", "\xE2\x82\xAC")); // int(23)

There is a difference of using mb_strpos? Does’t makes this work the same jobs? After all, does’t strpos seek a string (multiple byte)? Is there a reason to use instead strpos?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:58:17+00:00Added an answer on June 15, 2026 at 11:58 pm

    For UTF-8, matching the byte sequence is exactly the same as matching character sequence.

    So they both will find the needle at exactly the same point, but mb_strpos counts full UTF-8 byte sequencees before the needle, where as strpos calculates any bytes. So if your string had another multi-byte UTF-8 sequence, the results would be different:

    strpos("My symbolö utf-8 is the €.", "€") !== mb_strpos("My symbolö utf-8 is the €.", "€", 0, "UTF-8")
    

    But:

    strpos("My symbol utf-8 is the €.", "€") === mb_strpos("My symbol utf-8 is the €.", "€", 0, "UTF-8")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yes, I know I should have just forked the project from the beginning, but
(Yes I know I can call Java code from Scala; but that is pointless;
Yes I know, this title isn't really helpfull but this is the exact problem.
I have the following code (Yes I know it's quite long winded, but I
I have an AXIS2/JAX-WS web service using a code first implementation (yes I know,
I don't know when or why I should use [[UIApplication sharedApplication] delegate] I use
... for .NET with VS Team System Test Ed? Yes I know I should
Yes I know that it shouldn't be abused and that C# is primariy used
Ok so I start coding websites (yes I know I am almost 15 years
I´m trying to code a tooltip (Yes I know, I have my reasons to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.