当前位置:网站首页>PHP programming language (1) - operators
PHP programming language (1) - operators
2022-07-04 10:29:00 【Good night to you】
1. Assignment operator
“=” Used to assign values to variables
" x+ = y"==="x=x+y"
" x- = y"==="x=x-y"
" x * =y"==="x*y"
" x/ =y"===="x=x/y"
" x% =y"==="x=x%y"
" x. =y"==="x=x.y"
2. Arithmetic operator
“+” and
“-” Bad
“*” ride
“/” except (php Different from other languages , This has decimals )
“%” x%y model ,x Divide y The remainder of
“-x” -x Take the opposite
“.” x.y Juxtaposition , Connect two strings
php7+ Version added intdiv(), The return value of this function is the value of the first parameter divided by the second parameter and rounded
3.PHP Increasing / Decrement operator
++x Want to increase ,x+1, Then return x
x++ After increasing , return x, then x+1
--x Want to decrease ,x-1, Then return x
x-- Post decline , return x, then x-1
4.PHP Comparison operator ( The return values are Boolean )
x==y be equal to , Only compare values , Do not compare types
x===y Absolutely equal to , Compare values , Also compare types
x!=y It's not equal to
x<>y It's not equal to
x!==y Absolutely not equal to , The type cannot be the same
x>y Greater than
x<y Less than
x>=y Greater than or equal to
x<=y Less than or equal to
5.php Logical operators
x and y And If x and y All for true, Then return to true
x or y or If x and y At least one is true, Then return to true
x xor y Exclusive or If x and y There is and only one for true, Then return to true
x&&y And If x and y All for true, Then return to true
x||y or If x and y At least one is true, Then return to true
!x Not If x Not for true, Then return to true
5.PHP Array operators
x+y aggregate x and y Set
x==y equal If x and y With the same key / It's worth it , Then return to true
x===y Identity If x and y With the same key / It's worth it , And the order is the same, the type is the same , Then return to true
x!=y It's not equal to
x<>y It's not equal to
x!==y Absolutely not equal to , The type cannot be the same
6. Ternary operator
Format :a ? b:c
intend :a When established , The return value is b, If not, the return value is c
a??a:b
When it means :a Return... When not present b, Return when there is c
7. Combination comparator (php7 Above version )
Grammar format :
$c=$a<=>$b;
If $a>$b, be $c=1
If $a==$b, be $c=0
If $a<$b, be $c=-1
边栏推荐
- Introduction to extensible system architecture
- OSPF comprehensive experiment
- Time complexity and space complexity
- Native div has editing ability
- Button wizard business running learning - commodity quantity, price reminder, judgment Backpack
- What is an excellent architect in my heart?
- The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
- Rhcsa operation
- Read a piece of text into the vector object, and each word is stored as an element in the vector. Convert each word in the vector object to uppercase letters. Output the converted elements in the vect
- Rhsca day 11 operation
猜你喜欢

Linked list operation can never change without its roots

【Day1】 deep-learning-basics

Occasional pit compiled by idea

DCL statement of MySQL Foundation

Dynamic memory management

Introduction to extensible system architecture

Reasons and solutions for the 8-hour difference in mongodb data date display

Seven examples to understand the storage rules of shaped data on each bit

Three schemes of ZK double machine room

leetcode842. Split the array into Fibonacci sequences
随机推荐
Linked list operation can never change without its roots
Pod management
Histogram equalization
入职中国平安三周年的一些总结
Occasional pit compiled by idea
A little feeling
If you don't know these four caching modes, dare you say you understand caching?
leetcode842. Split the array into Fibonacci sequences
Latex learning insertion number - list of filled dots, bars, numbers
Write a program to define an array with 10 int elements, and take its position in the array as the initial value of each element.
DDL statement of MySQL Foundation
PHP代码审计3—系统重装漏洞
Rhsca day 11 operation
The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
使用 C# 提取 PDF 文件中的所有文字(支持 .NET Core)
/*The rewriter outputs the contents of the IA array. It is required that the type defined by typedef cannot be used in the outer loop*/
有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?
Write a program that uses pointers to set all elements of an int array to 4.18: 0.
System.currentTimeMillis() 和 System.nanoTime() 哪个更快?别用错了!
Application of safety monitoring in zhizhilu Denggan reservoir area