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でこれを行うことは可能ですか?
@ジョナサンサンプソン:あなたは文字列であることを、引数を強制する場合
は、このような何かをありがとう:-) – Dale
[ドキュメント](http://php.net/manual /en/function.is-numeric.php)[is](http://php.net/manual/en/function.is-int.php)[あなたの](http://php.net/manual/en /function.is-string.php)[friend](http://php.net/manual/en/function.is-object.php)。それを読んで。大好きです。これを使って。 –
どうしてありがとう? – Necko