RandomCompat_substr( string $binary_string, int $start, int $length = null )
substr() implementation that isn’t brittle to mbstring.func_overload
Description Description
This version just uses the default substr()
Parameters Parameters
- $binary_string
-
(string) (Required)
- $start
-
(int) (Required)
- $length
-
(int) (Optional) (optional)
Default value: null
Return Return
(string)
Source Source
File: wp-includes/random_compat/byte_safe_strings.php
function RandomCompat_substr($binary_string, $start, $length = null) { if (!is_string($binary_string)) { throw new TypeError( 'RandomCompat_substr(): First argument should be a string' ); } if (!is_int($start)) { throw new TypeError( 'RandomCompat_substr(): Second argument should be an integer' ); } if ($length !== null) { if (!is_int($length)) { throw new TypeError( 'RandomCompat_substr(): Third argument should be an integer, or omitted' ); } return (string) substr($binary_string, $start, $length); } return (string) substr($binary_string, $start); }
Expand full source code Collapse full source code View on Trac