Determines if a specified string represents an IP address or not.
Description
This function also detects the type of the IP address, returning either '4' or '6' to represent an IPv4 and IPv6 address respectively.This does not verify if the IP is a valid IP, only that it appears to be an IP address.
Parameters
$maybe_ipstring
A suspected IP address.
Return
int|false
Upon success, '4' or '6' to represent an IPv4 or IPv6 address, false upon failure.
Uses · 1
str_contains()Polyfill for `str_contains()` function added in PHP 8.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 6.7.7 tag, from src/wp-includes/class-wp-http.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.