91亚洲精品福利在线播放,欧美日韩国产在线人成app,天天躁日日躁疯人影院,sao虎视频最新网站入口,精品久久久久久中文字幕女

ReflectionFunctionAbstract::hasReturnType

(PHP 7, PHP 8)

ReflectionFunctionAbstract::hasReturnTypeChecks if the function has a specified return type

說(shuō)明

public ReflectionFunctionAbstract::hasReturnType(): bool

Checks whether the reflected function has a return type specified.

參數

此函數沒(méi)有參數。

返回值

Returns true if the function is a specified return type, otherwise false.

范例

示例 #1 ReflectionFunctionAbstract::hasReturnType() example

<?php

function to_int($param) : int {
    return (int) 
$param;
}

$reflection1 = new ReflectionFunction('to_int');
var_dump($reflection1->hasReturnType());

以上例程會(huì )輸出:

bool(true)

示例 #2 Usage on built-in functions

<?php

$reflection2 
= new ReflectionFunction('array_merge');

var_dump($reflection2->hasReturnType());

以上例程會(huì )輸出:

bool(false)

This is because many internal functions do not have types specified for their parameters or return values. It is therefore best to avoid using this method on built-in functions.

參見(jiàn)

91亚洲精品福利在线播放,欧美日韩国产在线人成app,天天躁日日躁疯人影院,sao虎视频最新网站入口,精品久久久久久中文字幕女