RandomCompat_substr() - WordPress 函数参考中文文档

返回介绍

RandomCompat_substr()

发布于 2017-09-11 字数2067 浏览 899 评论 0

RandomCompat_substr( string $binary_string,  int $start,  int $length = null )

substr() implementation that isn’t brittle to mbstring.func_overload


描述

This version just uses the default substr()


参数

$binary_string

(string)
(Required)

$start

(int)
(Required)

$length

(int)
(Optional)
(optional)

Default value: null


返回值

(string)


源代码

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 substr($binary_string, $start, $length);
            }

            return substr($binary_string, $start);
        }

Collapse full 源代码 code

View on Trac


相关函数

Uses

  • wp-includes/random_compat/byte_safe_strings.php:
    RandomCompat_strlen()

Used By

  • wp-includes/random_compat/random_bytes_dev_urandom.php:
    random_bytes()

User Contributed Notes

上一篇:RandomCompat_strlen()

下一篇:random_bytes()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!