php中的字符串类型大小写,是字符串还是字符串?
php 字符串类型的正式名称是什么?
What is the official name for the php string type?
它是像 c# 那样的字符串",还是像 Java 那样的字符串",或者两者之一?
Is it 'string' like c#, or 'String' like Java, or either?
我在 http://php.net/manual 中找不到它/en/language.types.string.php
我想用它来严格输入我的函数
I want to use it to strict type my function
function getImageName() : string;
或
function getImageName() : String;
由于 PHP 是一种部分区分大小写的语言 特别是关键字不区分大小写,大小写对于内置类型名称无关紧要.string
和 String
都将用作类型声明(又名类型提示").
As PHP is a partially case sensitive language and, in particular, keywords are NOT case sensitive, the case doesn't matter for built-in type names. Both string
and String
will work as type declaration (aka 'type hint').
官方文档提到了小写变体,所以可能使用小写关键字作为代码样式是个好主意——就像大多数 PHP 代码样式使用 foreach
而不是 Foreach,例如.
The official documentation mentions the lowercase variants, so it's probably a good idea to use lowercase keywords as code style — just like most PHP code styles use foreach
and not Foreach
, for example.
附言您可以在 PHP 函数参数页面上找到文档,'类型声明部分.