3v4l.org

run code in 300+ PHP versions simultaneously
<?php $t1 = hrtime(true); for ($i = 0; $i < 6000000; $i++) { hi1("hi", $i, [], new stdClass(), 0.0, true); } $t2 = hrtime(true); $t3 = hrtime(true); for ($i = 0; $i < 6000000; $i++) { hi2("hi", $i, [], new stdClass(), 0.0, true); } $t4 = hrtime(true); echo "Without types: " . (($t2 - $t1) / 1000000) . " ms\n"; echo "With types : " . (($t4 - $t3) / 1000000) . " ms\n"; /** * @param string $a * @param int $b * @param array $c * @param stdClass $d * @param float $e * @param bool $f * @return void */ function hi1($a, $b, $c, $d, $e, $f) { } function hi2(string $a, int $b, array $c, stdClass $d, float $e, bool $f): void { }

preferences:
25.67 ms | 404 KiB | 5 Q