您的位置 首页 php

PHP运算符分类

PHP运算符分类

广东IT 优就业

广州IT培训 老师今天说一说,PHP 运算符优先级 与分类。

一、运算符

运算符是可以通过给出的一或多个值(用编程行话来说,表达式)来产生另一个值(因而整个结构成为一个表达式)的东西。

运算符可按照其能接受几个值来分组。一元运算符只能接受一个值,例如 !(逻辑取反运算符)或 ++(递增运算符)。
二元运算符可接受两个值,例如熟悉的算术运算符 +(加)和 -(减),大多数 PHP 运算符都是这种。最后是唯一的 三元运算符 ?
:,可接受三个值;通常就简单称之为“三元运算符”(尽管称之为条件运算符可能更合适)。

PHP运算符分类

广东IT优就业

二、运算符分类

1、算数运算符

2、赋值运算符

3、 位运算符

4、比较运算符

5、错误控制运算符

6、执行运算符

7、递增/递减运算符

8、逻辑运算符

9、字符串运算符

10、数组运算符

11、类型运算符

三、运算符优先级

运算符优先级指定了两个表达式绑定得有多“紧密”。例如,表达式 1 + 5 * 3 的结果是 16 而不是 18
是因为乘号(“*”)的优先级比加号(“+”)高。必要时可以用括号来强制改变优先级。例如:(1 + 5) * 3 的值为 18。

如果运算符优先级相同,那运算符的结合方向决定了该如何运算。例如,”-“是左联的,那么 1 – 2 – 3 就等同于 (1 – 2) – 3 并且结果是
-4. 另外一方面,”=”是右联的,所以 $a = $b = $c 等同于 $a = ($b = $c)。

没有结合的相同优先级的运算符不能连在一起使用,例如 1 < 2 > 1 在PHP是不合法的。但另外一方面表达式 1 <= 1 == 1
是合法的, 因为 == 的优先级低于 <=。

括号的使用,哪怕在不是必要的场合下,通过括号的配对来明确标明运算顺序,而非靠运算符优先级和结合性来决定,通常能够增加代码的可读性。

下表按照优先级从高到低列出了运算符。同一行中的运算符具有相同优先级,此时它们的结合方向决定求值顺序。

PHP运算符分类

希望 广州IT培训 老师上述分享的内容对大家有所帮助。

PHP运算符分类

广东IT优就业

出处:www.cnblogs.com/csd97/p/8085398.html

更多IT精彩推荐:

吸金能力者-PHP工程师:

文章来源:智云一二三科技

文章标题:PHP运算符分类

文章地址:https://www.zhihuclub.com/79637.shtml

关于作者: 智云科技

热门文章

评论已关闭

26条评论

  1. This is because the majority of advanced anabolic steroid users have advanced so far into their progress and training that have reached more or less a dead end to their progress, no matter the effort or compounds utilized

  2. Chemotherapy versus chemoimmunotherapy CAF v CAFVP v CMF each MER for metastatic carcinoma of the breast a CALGB study

  3. Co administration of drugs such as phenytoin, phenobarbital, carbamazepine, rifampicin, isoniazid, ritonavir, efavirenz, and other inducers of CYP3A4 can induce the metabolism of azole antifungals

  4. For example, TZD suppresses the tumorigenesis of MCF 7 human breast cancer cells in nude mice, The median time on ERT since diagnosis was 6

  5. 33 See Tarasti, L, Strict Liability in Doping Cases in the Light of Decisions made by the Arbitration Panel of the IAAF, Conference Paper, 1997, and now op cit, Tarasti, fn 2

  6. I want any insurance I can get to be here to watch my kids grow up and become adults with families of their own

  7. The Internet began as a combination of those twoГў you could probably draw a good history as to what we did to create the American computing industry back in the Гў 50s However, looking at annual adherence over time from starting medication, there was a decrease in adherence the median adherence was 90, 82, 77, 59 and 51 in the first, second, third, fourth and fifth years, respectively

  8. Reactions can include runny nose, tearing eyes, itching, hives, wheals, wheezing, and in rare cases anaphylaxis How can I explain myself, my lingering ambivalence and skepticism

  9. The mechanism of action of CONSENSI is similar to the mechanism of action for its individual components, celecoxib and amlodipine, as described below

  10. One study examined A P use in individuals with renal impairment and found no issues with the use of A P, but it noted that dosage adjustments may be needed for proguanil because of the altered pharmacokinetics Amet et al a 9 7 record, one game out of the playoffs, with blowout wins in San Francisco and home against Green Bay, providing notches on their belt

  11. Bhat A, Vijaya C, Gowda VS The indifferent voice fell, and the peerless divine sword controlled by Zhao Ling directly killed Huang Tianxiao

  12. Due to the lack of recovery, the patient was hospitalized with the diagnosis of pneumonia and was treated with meropenem and levofloxacin

  13. However, if it is used in combination with other forms of therapy such as Palladia or metronomic cyclophosphamide and frusemide, it may lead to more side effects

  14. Castro appeared in court Thursday to faces charges that he kidnapped and raped three young women and held them in his home for a decade

  15. Using Danish nationwide population based registers, we confirmed our overall hypothesis that continued use of classes of angiotensin agents and calcium antagonists was associated with decreased rates of incident depression, whereas use of diuretics was not Initial evaluation of other women with benign endometrial cells may include either endometrial sampling or transvaginal ultrasound

  16. C Representative images from inguinal fat tissue It interferes with DNA synthesis, RNA processing, and protein synthesis

  17. A similar percentage of patients in each group had at least one adverse event in the first 5 days 53

网站地图