HTTP/2 301
server: nginx
date: Fri, 10 Oct 2025 05:30:23 GMT
content-type: text/html; charset=UTF-8
location: https://developer.wordpress.org/reference/functions/is_serialized_string/
x-content-type-options: nosniff
content-language: en
x-ua-compatible: IE=Edge
vary: Accept-Encoding, Cookie
expires: Thu, 01 Jan 1970 00:00:00 GMT
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
alt-svc: h3=":443"; ma=86400
strict-transport-security: max-age=31536000
HTTP/2 200
server: nginx
date: Fri, 10 Oct 2025 05:30:25 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
is_serialized_string() – Function | Developer.WordPress.org
is_serialized_string( string $data ): bool
Checks whether serialized data is of string type.
$data
stringrequiredSerialized data.
bool False if not a serialized string, true if it is.
function is_serialized_string( $data ) {
// if it isn't a string, it isn't a serialized string.
if ( ! is_string( $data ) ) {
return false;
}
$data = trim( $data );
if ( strlen( $data ) < 4 ) {
return false;
} elseif ( ':' !== $data[1] ) {
return false;
} elseif ( ! str_ends_with( $data, ';' ) ) {
return false;
} elseif ( 's' !== $data[0] ) {
return false;
} elseif ( '"' !== substr( $data, -2, 1 ) ) {
return false;
} else {
return true;
}
}
View all references View on Trac View on GitHub
Version | Description |
---|
2.0.5 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.