Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

function () ?type{} in php

As of PHP 7.1.0, type declarations can be marked 
nullable by prefixing the type name with a question mark (?).
This signifies that the value can be of the specified type or null.

<?php
class C {}

function f(?C $c) {
    var_dump($c);
}

f(new C);
f(null);
?>
 
PREVIOUS NEXT
Tagged: #function #php
ADD COMMENT
Topic
Name
2+4 =