Thursday, 15 April 2021

PHP 7 function param types

 This maybe useful for anyone who see this post since the availability of PHP 7

With PHP 7, its now possible to declare types. You can refer the following link for more information.

http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration

function(string $name, boolean $is_admin) {
    //do something
}

https://stackoverflow.com/questions/8962780/php-declare-arguments-type-of-a-function/45651955

No comments:

Post a Comment