当前位置:网站首页>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
边栏推荐
- Exercise 9-4 finding books (20 points)
- leetcode1-3
- The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
- C language - stack
- Basic principle of servlet and application of common API methods
- 转载:等比数列的求和公式,及其推导过程
- Native div has editing ability
- 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.
- Three schemes of ZK double machine room
- Evolution from monomer architecture to microservice architecture
猜你喜欢
Si vous ne connaissez pas ces quatre modes de mise en cache, vous osez dire que vous connaissez la mise en cache?
Evolution from monomer architecture to microservice architecture
入职中国平安三周年的一些总结
Histogram equalization
Custom type: structure, enumeration, union
【Day1】 deep-learning-basics
转载:等比数列的求和公式,及其推导过程
Latex learning insertion number - list of filled dots, bars, numbers
The future education examination system cannot answer questions, and there is no response after clicking on the options, and the answers will not be recorded
Recursion and divide and conquer strategy
随机推荐
【Day2】 convolutional-neural-networks
AUTOSAR from getting started to mastering 100 lectures (106) - SOA in domain controllers
有老师知道 继承RichSourceFunction自定义读mysql怎么做增量吗?
VLAN part of switching technology
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 1
MongoDB数据日期显示相差8小时 原因和解决方案
Velodyne configuration command
Deep learning 500 questions
Sword finger offer 05 (implemented in C language)
uniapp---初步使用websocket(长链接实现)
Kotlin set operation summary
Dos:disk operating system, including core startup program and command program
Reprint: summation formula of proportional series and its derivation process
Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
uniapp 小于1000 按原数字显示 超过1000 数字换算成10w+ 1.3k+ 显示
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
PHP代码审计3—系统重装漏洞
BGP advanced experiment
Lavel document reading notes -how to use @auth and @guest directives in lavel
IPv6 comprehensive experiment