How to resolve “must be an instance of string, string given” prior to PHP 7?

后端 未结 9 1245
情话喂你
情话喂你 2020-11-27 10:32

Here is my code:

function phpwtf(string $s) {
    echo \"$s\\n\";
}
phpwtf(\"Type hinting is da bomb\");

Which results in this error:

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 11:03

    I think typecasting on php on inside block, String on PHP is not object as I know:

提交回复
热议问题