php中的字符串类型大小写,是字符串还是字符串? [英] String type casing in php, is it string or String?

查看:69
本文介绍了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 是一种部分区分大小写的语言 特别是关键字不区分大小写,大小写对于内置类型名称无关紧要.stringString 都将用作类型声明(又名类型提示").

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 函数参数页面上找到文档,'类型声明部分.

这篇关于php中的字符串类型大小写,是字符串还是字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆