当前位置:网站首页>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
边栏推荐
- 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.
- Exercise 8-7 string sorting (20 points)
- MongoDB数据日期显示相差8小时 原因和解决方案
- Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
- Button wizard business running learning - commodity quantity, price reminder, judgment Backpack
- BGP ---- border gateway routing protocol ----- basic experiment
- /*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*/
- Differences among opencv versions
- 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
- The most detailed teaching -- realize win10 multi-user remote login to intranet machine at the same time -- win10+frp+rdpwrap+ Alibaba cloud server
猜你喜欢

Rhcsa day 9

Introduction to tree and binary tree

Three schemes of ZK double machine room

MongoDB数据日期显示相差8小时 原因和解决方案

Two way process republication + routing policy

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

Online troubleshooting

Devop basic command

VLAN part of switching technology

Custom type: structure, enumeration, union
随机推荐
Custom type: structure, enumeration, union
Realsense d435 d435i d415 depth camera obtains RGB map, left and right infrared camera map, depth map and IMU data under ROS
Exercise 9-4 finding books (20 points)
leetcode1-3
Dynamic address book
For programmers, if it hurts the most...
Debug:==42==ERROR: AddressSanitizer: heap-buffer-overflow on address
Rhcsa day 9
入职中国平安三周年的一些总结
The bamboo shadow sweeps the steps, the dust does not move, and the moon passes through the marsh without trace -- in-depth understanding of the pointer
Safety reinforcement learning based on linear function approximation safe RL with linear function approximation translation 2
Delayed message center design
Histogram equalization
Velodyne configuration command
MongoDB数据日期显示相差8小时 原因和解决方案
Use the data to tell you where is the most difficult province for the college entrance examination!
Crawl Zhejiang industry and trade news page
Rhcsa12
基于线性函数近似的安全强化学习 Safe RL with Linear Function Approximation 翻译 1
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法