gpt4 book ai didi

php - 类型声明前的问号(?)在php(?int)中意味着什么

转载 作者:IT王子 更新时间:2023-10-29 00:12:13 25 4
gpt4 key购买 nike

<分区>

我在https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Output/Output.php中看到过这段代码第 40 行他们正在使用 ?int。

public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
{
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
$this->formatter = $formatter ?: new OutputFormatter();
$this->formatter->setDecorated($decorated);
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com