当前位置:网站首页>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
边栏推荐
猜你喜欢

Use the data to tell you where is the most difficult province for the college entrance examination!

Online troubleshooting

MPLS: multi protocol label switching

DML statement of MySQL Foundation

Application of safety monitoring in zhizhilu Denggan reservoir area

uniapp 小于1000 按原数字显示 超过1000 数字换算成10w+ 1.3k+ 显示

Introduction to tree and binary tree

Three schemes of ZK double machine room

uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前

Introduction to extensible system architecture
随机推荐
Reprint: summation formula of proportional series and its derivation process
Time complexity and space complexity
leetcode729. My schedule 1
BGP ---- border gateway routing protocol ----- basic experiment
VLAN part of switching technology
Online troubleshooting
5g/4g wireless networking scheme for brand chain stores
Exercise 9-4 finding books (20 points)
Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
按键精灵跑商学习-商品数量、价格提醒、判断背包
uniapp 处理过去时间对比现在时间的时间差 如刚刚、几分钟前,几小时前,几个月前
Latex learning insertion number - list of filled dots, bars, numbers
Servlet基本原理与常见API方法的应用
If the uniapp is less than 1000, it will be displayed according to the original number. If the number exceeds 1000, it will be converted into 10w+ 1.3k+ display
System. Currenttimemillis() and system Nanotime (), which is faster? Don't use it wrong!
PHP代码审计3—系统重装漏洞
How do microservices aggregate API documents? This wave of show~
PHP code audit 3 - system reload vulnerability
When I forget how to write SQL, I
Lavel document reading notes -how to use @auth and @guest directives in lavel