PHP 算术运算符
运算符 | 名称 | 描述 | 实例 | 结果 |
---|---|---|---|---|
x + y | 加 | x 和 y 的和 | 2 + 2 | 4 |
x - y | 减 | x 和 y 的差 | 5 - 2 | 3 |
x * y | 乘 | x 和 y 的积 | 5 * 2 | 10 |
x / y | 除 | x 和 y 的商 | 15 / 5 | 3 |
x % y | 模(除法的余数) | x 除以 y 的余数 | 5 % 2 10 % 8 10 % 2 |
1 2 0 |
- x | 取反 | x 取反 | - 2 | |
a . b | 并置 | 连接两个字符串 | "Hi" . "Ha" | HiHa |
以下实例演示了使用不同算术运算符得到的不同结果:
1 2 3 4 5 6 7 8 9 |
|
Copy after login
相关阅读:
php strstr 判断一个字符串是否存在于里一个字符串中
php stristr() 函数查找字符串在另一字符串中的第一次出现
php strchr() 函数查找字符串在另一字符串中的第一次出现
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Assassin's Creed Shadows: Seashell Riddle Solution
2 weeks ago
By DDD
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics
CakePHP Tutorial
1378
52

