Source Code:
(back to article)
<?php // Example 1 declare(strict_types=1); function add(int $a, int $b) { return $a + $b; } // echo add(2, "3") will cause this error: Fatal error: Uncaught TypeError: Argument 2 passed to add() must be of the type integer, string given // Example 2 declare(ticks=1); function tick_handler() { echo "Tick" . PHP_EOL; } register_tick_function("tick_handler"); $a = 1; $a += 2; // Output: Tick Tick Tick
Result:
Report an issue