Answers for "php type hinting array"

PHP
6

php type hinting array

<?php	// use type hinting to specify the expected data type of an argument
function startParty(array $guests, array $food = null) {
    // party stuff...
}
$guests = array("Susan Foreman", "Sarah Jane Smith");
startParty($guests, null);
?>
Posted by: Guest on May-15-2021

Browse Popular Code Answers by Language