当前位置:网站首页>"Basic knowledge of PHP" implement mathematical operations in PHP
"Basic knowledge of PHP" implement mathematical operations in PHP
2022-07-27 08:06:00 【Go home at night】
Functional requirements
Use PHP The code implements simple mathematical operations , for example : Calculate and display separately 220 + 220、2 * 3 + 25 / 5 - 4、2 * (3 + 25) / 5 -4 Value
The sample code
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP Realize mathematical operations in </title>
</head>
<body>
<?php
echo 220 + 220; # 440
echo 2 * 3 + 25 / 5 - 4; # 7
echo 2 * (3 + 25) / 5 -4; # 7.2
?>
</body>
</html>Running results
The code analysis
echo 220 + 220;: take 220+220 Result “440”, adopt echo Statements are displayed on the page , After the output is completed, execute the next echo Statement output information “7”, At this time, the result displays the statement immediately after the output of the previous one , So the page will 3 The segment results are displayed on the same line and output in the page .
The sample code - Modify the line wrapping display of each result
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP Realize mathematical operations in </title>
</head>
<body>
<?php
echo "220 + 220"; # 440
echo "<br />";
echo 2 * 3 + 25 / 5 - 4; # 7
echo "<br />";
echo 2 * (3 + 25) / 5 -4; # 7.2
?>
</body>
</html>Running results
The code analysis
echo "<br />";: take HTML Medium <br /> Labels are displayed in the page , Each result is output in line feed .
边栏推荐
- [golang] golang develops wechat official account web page authorization function
- [resolved] the new version of pychart (2022) connects to the server to upload files and reports an error of "command Rsync is not found in path", and the files cannot be synchronized
- 浅谈数据安全
- SETTA 2020 国际学术会议即将召开,欢迎大家参加!
- 2020 International Machine Translation Competition: Volcano translation won five championships
- What are the software tuning methods? Let's see what Feiteng technology experts say about dragon lizard technology
- 孙子出题难,儿子监考严。老子不会做,还我上学钱
- 大家节日快乐哈
- How to update PIP3? And running PIP as the 'root' user can result in broken permissions and conflicting behavior
- Abstract factory pattern
猜你喜欢
随机推荐
What is the real HTAP? (1) Background article
Lua iterator
What other methods are available for MySQL index analysis besides explain
Kalibr calibration realsensed435i -- multi camera calibration
擎创科技加入龙蜥社区,共建智能运维平台新生态
Promise详解
Combined use of C WinForm form form event and delegate
【目标检测】YOLOv6理论解读+实践测试VisDrone数据集
C language: random number + Hill sort
Happy holidays, everyone
End of year summary
Prevent cookies from modifying ID to cheat login
杂谈:把肉都烂在锅里就是保障学生权益了?
PHP realizes data interaction with MySQL
What are the software tuning methods? Let's see what Feiteng technology experts say about dragon lizard technology
[applet] how to get wechat applet code upload key?
SQL labs SQL injection platform - level 1 less-1 get - error based - Single Quotes - string (get single quote character injection based on errors)
docker 安装mysql后进入容器内部发现登录不了mysql
[resolved] the new version of pychart (2022) connects to the server to upload files and reports an error of "command Rsync is not found in path", and the files cannot be synchronized
DEMO SUBMIT 某程序并获取该程序ALV数据









