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
Stay organized with collections
Save and categorize content based on your preferences.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["This page outlines PHP utility functions related to string manipulation, including checking for prefixes and suffixes, and Base64 URL encoding/decoding."],["The `endsWith` function determines if a string ends with a specified suffix, returning `true` if it does."],["The `startsWith` function checks if a string begins with a given prefix, returning `true` if it does."],["The `base64UrlEncode` function encodes a string to be URL-safe, while `base64UrlDecode` reverses this process, returning the original string."]]],[]]