執行 ❯
獲取您
自己的 PHP
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
<?php declare(strict_types=1); // strict requirement function addNumbers(int $a, int $b) { return $a + $b; } echo addNumbers(5, "5 days"); // since strict is enabled and "5 days" is not an integer, an error will be thrown ?>
PHP 致命錯誤:未捕獲的 TypeError:addNumbers() 的第二個引數必須是 integer 型別,但傳入了 string 型別,在 /home/bWN0Ml/prog.php 的第 6 行呼叫,並在 /home/bWN0Ml/prog.php 的第 3 行定義。堆疊跟蹤:#0 /home/bWN0Ml/prog.php(6): addNumbers(5, '5 days') #1 {main} 丟擲 /home/bWN0Ml/prog.php 的第 3 行