我想或者我更喜欢用 Php 指示函数中参数的真实类型,这可能吗?
例子 :
<?php
function test($param)
{
echo $param;
}
$str = "hiiiii everyone";
test($str);
?>
而不是把 $param 放在函数测试中;我想放这样的东西
function test(string $param) // string is the type of the param, that can be int, long ect or an object which I had created.
使用最新版本的 PHP 可以做到这一点吗?