Skip to content

mb_strpos: document "offset" / "return" typeΒ #5520

@homersimpsons

Description

@homersimpsons

Affected page

https://www.php.net/manual/en/function.mb-strpos.php

Current issue

It is unclear from the documentation whether mb_strpos returns a byte offset or a char offset. It returns a char offset:

var_dump(mb_strpos("🐘H🐘é", "é")); // => 3
var_dump(mb_strpos("🐘H🐘é", "🐘", 1)); // => 2

Suggested improvement

An example can be enough, wording can be improved too as "numeric position" does not indicate how is this position interpreted (in my opinion). I cannot think of a great wording yet.

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions