当前位置:网站首页>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
边栏推荐
- Differences among opencv versions
- DDL statement of MySQL Foundation
- Button wizard business running learning - commodity quantity, price reminder, judgment Backpack
- RHCE day 3
- OSPF summary
- 如果不知道這4種緩存模式,敢說懂緩存嗎?
- Idea SSH channel configuration
- Introduction to tree and binary tree
- Uniapp--- initial use of websocket (long link implementation)
- Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
猜你喜欢
OSPF comprehensive experiment
DML statement of MySQL Foundation
Rhcsa12
【Day1】 deep-learning-basics
Three schemes of ZK double machine room
DDL statement of MySQL Foundation
Evolution from monomer architecture to microservice architecture
Application of safety monitoring in zhizhilu Denggan reservoir area
MongoDB数据日期显示相差8小时 原因和解决方案
【Day2】 convolutional-neural-networks
随机推荐
RHCE day 3
/*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*/
对于程序员来说,伤害力度最大的话。。。
使用 C# 提取 PDF 文件中的所有文字(支持 .NET Core)
Use C to extract all text in PDF files (support.Net core)
Exercise 7-4 find out the elements that are not common to two arrays (20 points)
Seven examples to understand the storage rules of shaped data on each bit
Doris / Clickhouse / Hudi, a phased summary in June
Application of safety monitoring in zhizhilu Denggan reservoir area
DCL statement of MySQL Foundation
Two way process republication + routing policy
Collection of practical string functions
BGP advanced experiment
Leetcode48. Rotate image
From programmers to large-scale distributed architects, where are you (I)
PHP code audit 3 - system reload vulnerability
The time difference between the past time and the present time of uniapp processing, such as just, a few minutes ago, a few hours ago, a few months ago
OSPF summary
Histogram equalization
C language structure to realize simple address book