WPDev.one
Core Function
View Source on Trac ↗

str_contains()

str_contains( mixed $haystack, mixed $needle )

Polyfill for `str_contains()` function added in PHP 8.0.

Parameters 2 required

Name / Type Description
$haystack
string

The string to search in.

Required
$needle
string

The substring to search for in the `$haystack`.

Required

Return Value

(bool)
True if `$needle` is in `$haystack`, otherwise false.

Function Information

Since Version
5.9.0
Source File
wp-includes/compat.php
Advertisement