PHP关键字区分大小写吗? [英] Are PHP keywords case-sensitive?
本文介绍了PHP关键字区分大小写吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,以下程序有意义吗?如果是这样,它将打印什么?
For example, is the following program meaningful, and if so what should it print?
<?php
FuncTIon fOo($x) { eChO $x; }
FOO('bar');
IF (TRuE) { echO 'qux'; }
?>
我的解释器运行它并输出barqux
,这意味着关键字不区分大小写:
My interpreter runs it and prints barqux
, implying the keywords are not case-sensitive:
$ php case_sensitive_keywords.php
barqux
$ php --version
PHP 5.5.7-1+sury.org~precise+1 (cli) (built: Dec 12 2013 21:37:40)
但是,去年问了同样的问题 ,答案表明关键字 区分大小写,与我的PHP解释器告诉我的内容直接矛盾!
However, this same question was asked last year, and the answers say that keywords are case-sensitive, in direct contradiction to what my PHP interpreter appears to tell me!
推荐答案
区分大小写(用户定义和PHP定义)
Case sensitive (both user defined and PHP defined)
- 变量
- 常量
- 数组键
- 类属性
- 类常量
不区分大小写(用户定义和PHP均定义)
Case insensitive (both user defined and PHP defined)
- 功能
- 类构造函数
- 类方法
- 关键字和构造(如果为null,则为null,foreach,echo等)
这篇关于PHP关键字区分大小写吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文