我想或者我会更喜欢在一个带有Php的函数中指出参数的实际类型,这可能吗?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?
@Jonathan桑普森:谢谢:-) – Dale 2012-04-18 16:16:35
[文件](http://php.net/manual /en/function.is-numeric.php)[is](http://php.net/manual/en/function.is-int.php)[your](http://php.net/manual/en /function.is-string.php)[friend](http://php.net/manual/en/function.is-object.php)。阅读。爱它。用它。 – 2012-04-18 16:17:06
为什么要谢谢你? – Necko 2012-04-18 16:23:15