PHP 8 · Types and functions
Declare types
Type parameters and return values. ?string means string or null.
function greet(string $name, ?string $title = null): string
{
return trim("$title $name");
}
PHP 8 · Types and functions
Type parameters and return values. ?string means string or null.
function greet(string $name, ?string $title = null): string
{
return trim("$title $name");
}
Was this page helpful?