PHP 5 has reached end of support and will be deprecated on January 31, 2026. After deprecation, you won't be able to deploy PHP 5 applications, even if your organization previously used an organization policy to re-enable deployments of legacy runtimes. Your existing PHP 5 applications will continue to run and receive traffic after their deprecation date. We recommend that you migrate to the latest supported version of PHP.

\google\appengine\util\StringUtil

FINAL

Various PHP string related utility functions.

Methods

endsWith

STATIC

endsWith(string $input, string $suffix) : boolean

Return true if the first paramater contains the second parameter at the end.

Parameters

Name Description

$input

string

The input string which may contain the suffix.

$suffix

string

The string to look for at the end of the input.

Returns

boolean

true iff the input contains the suffix at the end.

startsWith

STATIC

startsWith(string $input, string $prefix) : boolean

Return true if the input string starts with the prefix string.

Parameters

Name Description

$input

string

The string which may contain the prefix at the start.

$prefix

string

The string to look for at the start of the input.

Returns

boolean

true iff the input contains the prefix at the start.

base64UrlEncode

STATIC

base64UrlEncode(string $input) : string

Base64 encode a string, ensuring that the output is safe to use in a URL.

Parameters

Name Description

$input

string

The string which may not be url safe.

Returns

string

A Base64 encoded url safe string.

base64UrlDecode

STATIC

base64UrlDecode(string $input) : string

Base64 decode a string that was encoded with base64UrlEncode.

Parameters

Name Description

$input

string

The url safe Base64 encoded string.

Returns

string

The original string which may not be url safe.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年06月16日 UTC.