`

PHP Operators

    博客分类:
  • PHP
PHP 
阅读更多

PHP Operators

This section lists the different operators used in PHP.

Arithmetic Operators

OperatorDescriptionExampleResult
+Additionx=2
x+2
4
-Subtractionx=2
5-x
3
*Multiplicationx=4
x*5
20
/Division15/5
5/2
3
2.5
%Modulus (division remainder)5%2
10%8
10%2
1
2
0
++Incrementx=5
x++
x=6
--Decrementx=5
x--
x=4

Assignment Operators

OperatorExampleIs The Same As
=x=yx=y
+=x+=yx=x+y
-=x-=yx=x-y
*=x*=yx=x*y
/=x/=yx=x/y
.=x.=yx=x.y
%=x%=yx=x%y

Comparison Operators

OperatorDescriptionExample
==is equal to5==8 returns false
!=is not equal5!=8 returns true
>is greater than5>8 returns false
<is less than5<8 returns true
>=is greater than or equal to5>=8 returns false
<=is less than or equal to5<=8 returns true

Logical Operators

OperatorDescriptionExample
&&andx=6
y=3

(x < 10 && y > 1) returns true

||orx=6
y=3

(x==5 || y==5) returns false

!notx=6
y=3

!(x==y) returns true

分享到:
评论

相关推荐

    PHP Operators-开源

    php操作员手册..描述了在php中工作所需的最基本的操作员...

    Mastering PHP 7

    This book is for intermediate level developers who want to become a master of PHP. Basic knowledge of PHP is required across areas such as basic syntax, types, variables, constants, expressions, ...

    php7新特性

    7. New Operators(新的运算符) PHP7引入了几个新的运算符,如太空船运算符()用于比较两个表达式的大小,null合并运算符(??)用于简化变量赋值。 8. Return Type Declarations(返回类型声明) PHP7允许...

    php英文开发文档

    •Operators •Control Structures •Functions •Classes and Objects •Namespaces •Exceptions •Generators •References Explained •Predefined Variables •Predefined Exceptions •Predefined Interfaces ...

    PHP-manual外文文献

    - **Operators**(运算符):列举并解释PHP支持的各种运算符,包括算术运算符、逻辑运算符等。 - **Control Structures**(控制结构):说明PHP中的控制流语句,如if、switch、循环等。 - **Functions**(函数)...

    php.ini-development

    Expressions in the INI file are limited to bitwise operators and parentheses: ; | bitwise OR ; ^ bitwise XOR ; & bitwise AND ; ~ bitwise NOT ; ! boolean NOT ; Boolean flags can be turned on using ...

    PHP经典教程 PHP 5 Fast & Easy Web Development

    Chapter 5 - Introducing Variables and Operators Chapter 6 - Using PHP Variables Part III - Start with the Simple Stuff Chapter 7 - Displaying Dynamic Content Chapter 8 - Sending E-Mail ...

    Beginning PHP 5.3

    - **Operators:** Description of different operators used in PHP, such as arithmetic, assignment, comparison, logical, and bitwise operators. - **Expressions:** Explanation of expressions in PHP, ...

    php reference beginner to intermediate

    - **Operators**:涵盖了PHP中的运算符,包括算术运算符、赋值运算符、比较运算符、逻辑运算符、字符串运算符等。 - **Control Structures**:涉及到PHP中的控制结构,例如条件语句(if、else、switch)和循环语句...

    Apress.PHP.7.Solutions.4th.Edition.rar

    New features include the spaceship and null coalesce operators, generators, using array shorthand syntax for list(), array dereferencing, and array unpacking with the splat operator. The problem is,...

    PHP Reactive Programming

    PHP Reactive Programming by Martin Sikora English | 24 Mar. 2017 | ASIN: B01IBPRAA8 | 364 Pages | AZW3 | 3.46 MB ...Using Advanced Operators and Techniques in RxPHP Reusing RxPHP Techniques in RxJS

    kitap:PHP教程样本应用程序

    比较运算符comparisonOperators.php 逻辑运算符logicalOperators.php PHP中的条件表达式 if / else / elseif语句ifElse.php 开关语句switch.php 三元运算符ternaryOperator.php PHP中的数组 PHP arrays.php中...

    Technical 5 in 1 Box Set [Chromecast Linux XML PHP Python]

    • Control operators • Shell variables • Shell embedding and options • File globbing Book 3 - XML Programming The Ultimate Guide to Fast, Easy, and Efficient Learning of XML Programming ...

    PHP.and.Algorithmic.Thinking.for.the.Complete.Beginner.1503015

    Chapter 7 Operators Chapter 8 Trace Tables Chapter 9 Using NetBeans IDE Section 3 Sequence Control Structures Chapter 10 Introduction to Sequence Control Structures Chapter 11 Manipulating Numbers ...

    GoogleSearchOperators:用于创建和解析 Google 搜索运算符的 PHP 库

    最大-键:值键分隔符分隔符意义+ 和—— 并不是| OR(在 Google Operators 中不存在)值分隔符分隔符意义: 是 = :&lt; 是 &lt; :&gt; 是 &gt; :&gt;= 是 &gt;= :&gt;= 是 &lt;= :val1..val2 在 val1 和 val2 之间:val1.val2.val3 ...

    恶意软件查杀助理 11.05 简体绿软版_查杀超过460多款恶意

    http://hanranran.5d6d.com/bbs.php 快乐网赚论坛 http://wangzhuan630.5d6d.com/bbs.php 中国网赚论坛 http://wangzhuan9630.finance.topzj.com/index.php 竹林有约论坛 http://jfh630.topzj.com/ 大学生创业...

    详解php运行环境配置phpini配置及php基础教程.docx

    4. Combined Assignment Operators:+=、-=、*=、/=、%=、.=,用于将操作符与赋值操作符结合使用 5. 自动增减操作符: ++$variable、--$variable,用于自增或自减变量的值 6. 比较操作符:==、!=、===、&gt;=、&gt;、&lt;、 7...

    php的instanceof和判断闭包Closure操作示例

    为了深入学习,建议查阅 PHP 官方文档,如提供的链接所示:[PHP 类型运算符](http://php.net/manual/zh/language.operators.type.php) 和 [Closure 类](http://php.net/manual/zh/class.closure.php)。通过实践和...

    php_6_fast_and_easy_web_development.pdf

    Testing the PHP Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 PART II THE ABSOLUTE BASICS OF CODING IN PHP. . . . 49 Chapter 4 Mixing PHP and ...

    PHP通过API获取手机号码归属地

    &lt;Operators&gt;中国移动&lt;/Operators&gt; &lt;Card&gt;GSM ``` 了解了API的基础使用方法后,我们可以编写一个PHP函数,通过这个函数我们可以很方便地获取手机号码的归属地信息。该函数名为getMobileInfo,它接收一个手机号码...

Global site tag (gtag.js) - Google Analytics