Skip to content

Passing empty string to needle arg always returns 0 #4783

@derikb

Description

@derikb

From manual page: https://php.net/function.strpos


Passing an empty string to the $needle arg will cause strpos to always return 0. That is not at all clear from the docs, and perhaps more prominent since php 8 stopped throwing warnings for that. Might be good if the Needle or Return documentation mentioned that as it's not totally intuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions