<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>PHP</title><link>https://0977a.cn/</link><description>数据时代</description><item><title>PHP Switch 语句</title><link>https://0977a.cn/?id=17</link><description>&lt;div id=&quot;intro&quot; style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: 微软雅黑; color: rgb(63, 63, 63); font-weight: bold; font-size: 16px; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 24px;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;switch 语句用于基于不同条件执行不同动作。&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;Switch 语句&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;如果您希望有选择地执行若干代码块之一，请使用 Switch 语句。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;使用 Switch 语句可以避免冗长的 if..elseif..else 代码块。&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;语法&lt;/h3&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;switch&amp;nbsp;(expression)
{
case&amp;nbsp;label1:
&amp;nbsp;&amp;nbsp;expression&amp;nbsp;=&amp;nbsp;label1&amp;nbsp;时执行的代码&amp;nbsp;;
&amp;nbsp;&amp;nbsp;break;&amp;nbsp;&amp;nbsp;
case&amp;nbsp;label2:
&amp;nbsp;&amp;nbsp;expression&amp;nbsp;=&amp;nbsp;label2&amp;nbsp;时执行的代码&amp;nbsp;;
&amp;nbsp;&amp;nbsp;break;
default:
&amp;nbsp;&amp;nbsp;表达式的值不等于&amp;nbsp;label1&amp;nbsp;及&amp;nbsp;label2&amp;nbsp;时执行的代码;
}&lt;/pre&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;工作原理：&lt;/p&gt;&lt;ol style=&quot;margin-top: 15px; margin-bottom: 20px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;对表达式（通常是变量）进行一次计算&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;把表达式的值与结构中 case 的值进行比较&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;如果存在匹配，则执行与 case 关联的代码&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;代码执行后，&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;break 语句&lt;/span&gt;阻止代码跳入下一个 case 中继续执行&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;如果没有 case 为真，则使用 default 语句&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$favfruit=&amp;quot;orange&amp;quot;;switch&amp;nbsp;($favfruit)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&amp;quot;apple&amp;quot;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Your&amp;nbsp;favorite&amp;nbsp;fruit&amp;nbsp;is&amp;nbsp;apple!&amp;quot;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&amp;quot;banana&amp;quot;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Your&amp;nbsp;favorite&amp;nbsp;fruit&amp;nbsp;is&amp;nbsp;banana!&amp;quot;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&amp;quot;orange&amp;quot;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Your&amp;nbsp;favorite&amp;nbsp;fruit&amp;nbsp;is&amp;nbsp;orange!&amp;quot;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&amp;nbsp;&amp;nbsp;&amp;nbsp;default:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Your&amp;nbsp;favorite&amp;nbsp;fruit&amp;nbsp;is&amp;nbsp;neither&amp;nbsp;apple,&amp;nbsp;banana,&amp;nbsp;or&amp;nbsp;orange!&amp;quot;;
}?&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:29:30 +0800</pubDate></item><item><title>PHP if...else...elseif 语句</title><link>https://0977a.cn/?id=16</link><description>&lt;div id=&quot;intro&quot; style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: 微软雅黑; color: rgb(63, 63, 63); font-weight: bold; font-size: 16px; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 24px;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;条件语句用于基于不同条件执行不同的动作&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 条件语句&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在您编写代码时，经常会希望为不同的决定执行不同的动作。您可以在代码中使用条件语句来实现这一点。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在 PHP 中，我们可以使用以下条件语句：&lt;/p&gt;&lt;ul style=&quot;margin-top: 15px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;if 语句&lt;/span&gt;&amp;nbsp;- 如果指定条件为真，则执行代码&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;if...else 语句&lt;/span&gt;&amp;nbsp;- 如果条件为 true，则执行代码；如果条件为 false，则执行另一端代码&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;if...elseif....else 语句&lt;/span&gt;&amp;nbsp;- 根据两个以上的条件执行不同的代码块&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;switch 语句&lt;/span&gt;&amp;nbsp;- 选择多个代码块之一来执行&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP - if 语句&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;if 语句用于&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;在指定条件为 true 时&lt;/span&gt;执行代码。&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;语法&lt;/h3&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;if&amp;nbsp;(条件)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;当条件为&amp;nbsp;true&amp;nbsp;时执行的代码;
}&lt;/pre&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例将输出 &amp;quot;Have a good day!&amp;quot;，如果当前时间 (HOUR) 小于 20：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$t=date(&amp;quot;H&amp;quot;);if&amp;nbsp;($t&amp;lt;&amp;quot;20&amp;quot;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Have&amp;nbsp;a&amp;nbsp;good&amp;nbsp;day!&amp;quot;;
}?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_if&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP - if...else 语句&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;请使用 if....else 语句&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;在条件为 true 时执行代码&lt;/span&gt;，&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;在条件为 false 时执行另一段代码&lt;/span&gt;。&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;语法&lt;/h3&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;if&amp;nbsp;(条件)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;条件为&amp;nbsp;true&amp;nbsp;时执行的代码;
}&amp;nbsp;else&amp;nbsp;{
&amp;nbsp;&amp;nbsp;条件为&amp;nbsp;false&amp;nbsp;时执行的代码;
}&lt;/pre&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;如果当前时间 (HOUR) 小于 20，下例将输出 &amp;quot;Have a good day!&amp;quot;，否则输出 &amp;quot;Have a good night!&amp;quot;：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$t=date(&amp;quot;H&amp;quot;);if&amp;nbsp;($t&amp;lt;&amp;quot;20&amp;quot;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Have&amp;nbsp;a&amp;nbsp;good&amp;nbsp;day!&amp;quot;;
}&amp;nbsp;else&amp;nbsp;{&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Have&amp;nbsp;a&amp;nbsp;good&amp;nbsp;night!&amp;quot;;
}?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_if_else&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP - if...elseif....else 语句&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;请使用 if....elseif...else 语句来&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;根据两个以上的条件执行不同的代码&lt;/span&gt;。&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;语法&lt;/h3&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;if&amp;nbsp;(条件)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;条件为&amp;nbsp;true&amp;nbsp;时执行的代码;
}&amp;nbsp;elseif&amp;nbsp;(condition)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;条件为&amp;nbsp;true&amp;nbsp;时执行的代码;
}&amp;nbsp;else&amp;nbsp;{
&amp;nbsp;&amp;nbsp;条件为&amp;nbsp;false&amp;nbsp;时执行的代码;
}&lt;/pre&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;如果当前时间 (HOUR) 小于 10，下例将输出 &amp;quot;Have a good morning!&amp;quot;，如果当前时间小于 20，则输出 &amp;quot;Have a good day!&amp;quot;。否则将输出 &amp;quot;Have a good night!&amp;quot;：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$t=date(&amp;quot;H&amp;quot;);if&amp;nbsp;($t&amp;lt;&amp;quot;10&amp;quot;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Have&amp;nbsp;a&amp;nbsp;good&amp;nbsp;morning!&amp;quot;;
}&amp;nbsp;elseif&amp;nbsp;($t&amp;lt;&amp;quot;20&amp;quot;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Have&amp;nbsp;a&amp;nbsp;good&amp;nbsp;day!&amp;quot;;
}&amp;nbsp;else&amp;nbsp;{&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;Have&amp;nbsp;a&amp;nbsp;good&amp;nbsp;night!&amp;quot;;
}?&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:29:09 +0800</pubDate></item><item><title>PHP 运算符</title><link>https://0977a.cn/?id=15</link><description>&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 算数运算符&lt;/h2&gt;&lt;table class=&quot;dataintable&quot; width=&quot;810&quot;&gt;&lt;tbody style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot; class=&quot;firstRow&quot;&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 140.797px;&quot;&gt;运算符&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 140.797px;&quot;&gt;名称&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;例子&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;结果&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;显示结果&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;+&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;加法&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x + $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x 与 $y 求和&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_addition&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;-&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;减法&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x - $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x 与 $y 的差数&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_subtraction&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;*&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;乘法&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x * $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x 与 $y 的乘积&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_multiplication&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;/&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;除法&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x / $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x 与 $y 的商数&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_division&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;%&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;取模&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x % $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x 除 $y 的余数&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_modulus&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例展示了使用不同算数运算符的不同结果：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php&amp;nbsp;$x=17;&amp;nbsp;
$y=8;echo&amp;nbsp;($x&amp;nbsp;+&amp;nbsp;$y);&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;25echo&amp;nbsp;($x&amp;nbsp;-&amp;nbsp;$y);&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;9echo&amp;nbsp;($x&amp;nbsp;*&amp;nbsp;$y);&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;136echo&amp;nbsp;($x&amp;nbsp;/&amp;nbsp;$y);&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;2.125echo&amp;nbsp;($x&amp;nbsp;%&amp;nbsp;$y);&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;1?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_arithmetic&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 赋值运算符&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 赋值运算符用于向变量写值。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 中基础的赋值运算符是 &amp;quot;=&amp;quot;。这意味着右侧赋值表达式会为左侧运算数设置值。&lt;/p&gt;&lt;table class=&quot;dataintable&quot; width=&quot;810&quot;&gt;&lt;tbody style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot; class=&quot;firstRow&quot;&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 140.797px;&quot;&gt;赋值&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 140.797px;&quot;&gt;等同于&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;描述&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;显示结果&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x = y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x = y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;右侧表达式为左侧运算数设置值。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_set&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x += y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x = x + y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;加&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_addition2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x -= y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x = x - y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;减&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_subtraction2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x *= y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x = x * y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;乘&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_multiplication2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x /= y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x = x / y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;除&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_division2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x %= y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;x = x % y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;模数&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_modulus2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例展示了使用不同赋值运算符的不同结果：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php&amp;nbsp;$x=17;&amp;nbsp;
echo&amp;nbsp;$x;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;17$y=17;&amp;nbsp;
$y&amp;nbsp;+=&amp;nbsp;8;echo&amp;nbsp;$y;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;25$z=17;
$z&amp;nbsp;-=&amp;nbsp;8;echo&amp;nbsp;$z;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;9$i=17;
$i&amp;nbsp;*=&amp;nbsp;8;echo&amp;nbsp;$i;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;136$j=17;
$j&amp;nbsp;/=&amp;nbsp;8;echo&amp;nbsp;$j;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;2.125$k=17;
$k&amp;nbsp;%=&amp;nbsp;8;echo&amp;nbsp;$k;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;1?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_assignment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 字符串运算符&lt;/h2&gt;&lt;table class=&quot;dataintable&quot; width=&quot;810&quot;&gt;&lt;tbody style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot; class=&quot;firstRow&quot;&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;运算符&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;名称&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;例子&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;结果&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;显示结果&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;.&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;串接&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$txt1 = &amp;quot;Hello&amp;quot; $txt2 = $txt1 . &amp;quot; world!&amp;quot;&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;现在 $txt2 包含 &amp;quot;Hello world!&amp;quot;&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_string1&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;.=&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;串接赋值&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$txt1 = &amp;quot;Hello&amp;quot; $txt1 .= &amp;quot; world!&amp;quot;&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;现在 $txt1 包含 &amp;quot;Hello world!&amp;quot;&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_string2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例展示了使用字符串运算符的结果：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$a&amp;nbsp;=&amp;nbsp;&amp;quot;Hello&amp;quot;;
$b&amp;nbsp;=&amp;nbsp;$a&amp;nbsp;.&amp;nbsp;&amp;quot;&amp;nbsp;world!&amp;quot;;echo&amp;nbsp;$b;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;Hello&amp;nbsp;world!$x=&amp;quot;Hello&amp;quot;;
$x&amp;nbsp;.=&amp;nbsp;&amp;quot;&amp;nbsp;world!&amp;quot;;echo&amp;nbsp;$x;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;Hello&amp;nbsp;world!?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 递增/递减运算符&lt;/h2&gt;&lt;table class=&quot;dataintable&quot; width=&quot;810&quot;&gt;&lt;tbody style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot; class=&quot;firstRow&quot;&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 140.797px;&quot;&gt;运算符&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 140.797px;&quot;&gt;名称&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;描述&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;显示结果&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;++$x&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;前递增&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x 加一递增，然后返回 $x&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_pre_increment&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x++&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;后递增&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;返回 $x，然后 $x 加一递增&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_post_increment&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;--$x&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;前递减&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x 减一递减，然后返回 $x&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_pre_decrement&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x--&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;后递减&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;返回 $x，然后 $x 减一递减&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_post_decrement&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例展示了使用不同递增/递减运算符的不同结果：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$x=17;&amp;nbsp;
echo&amp;nbsp;++$x;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;18$y=17;&amp;nbsp;
echo&amp;nbsp;$y++;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;17$z=17;echo&amp;nbsp;--$z;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;16$i=17;echo&amp;nbsp;$i--;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;17?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_increment_decrement&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 比较运算符&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 比较运算符用于比较两个值（数字或字符串）：&lt;/p&gt;&lt;table class=&quot;dataintable&quot; width=&quot;810&quot;&gt;&lt;tbody style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot; class=&quot;firstRow&quot;&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 59.8906px;&quot;&gt;运算符&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 132.703px;&quot;&gt;名称&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 100.344px;&quot;&gt;例子&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 351.125px;&quot;&gt;结果&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;显示结果&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;==&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;等于&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x == $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 等于 $y，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_equal&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;===&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;全等（完全相同）&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x === $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 等于 $y，且它们类型相同，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_identical&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;!=&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;不等于&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x != $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 不等于 $y，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_not_equal&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&amp;lt;&amp;gt;&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;不等于&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x &amp;lt;&amp;gt; $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 不等于 $y，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_not_equal2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;!==&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;不全等（完全不同）&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x !== $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 不等于 $y，或它们类型不相同，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_not_identical&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&amp;gt;&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;大于&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x &amp;gt; $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 大于 $y，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_greater_than&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&amp;lt;&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;小于&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x &amp;lt; $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 小于 $y，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_less_than&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&amp;gt;=&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;大于或等于&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x &amp;gt;= $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 大于或者等于 $y，则返回 true.&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_greater_than2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&amp;lt;=&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;小于或等于&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x &amp;lt;= $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 小于或者等于 $y，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_less_than2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例展示了使用某些比较运算符的不同结果：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$x=17;&amp;nbsp;
$y=&amp;quot;17&amp;quot;;

var_dump($x&amp;nbsp;==&amp;nbsp;$y);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;
var_dump($x&amp;nbsp;===&amp;nbsp;$y);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;
var_dump($x&amp;nbsp;!=&amp;nbsp;$y);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;
var_dump($x&amp;nbsp;!==&amp;nbsp;$y);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;

$a=17;
$b=8;

var_dump($a&amp;nbsp;&amp;gt;&amp;nbsp;$b);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;
var_dump($a&amp;nbsp;&amp;lt;&amp;nbsp;$b);?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_comparison&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 逻辑运算符&lt;/h2&gt;&lt;table class=&quot;dataintable&quot; width=&quot;810&quot;&gt;&lt;tbody style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot; class=&quot;firstRow&quot;&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 59.8906px;&quot;&gt;运算符&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 100.344px;&quot;&gt;名称&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 100.344px;&quot;&gt;例子&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 383.5px;&quot;&gt;结果&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;显示结果&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;and&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;与&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x and $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 和 $y 都为 true，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_and&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;or&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;或&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x or $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 和 $y 至少有一个为 true，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_or&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;xor&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;异或&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x xor $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 和 $y 有且仅有一个为 true，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_xor&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&amp;amp;&amp;amp;&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;与&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x &amp;amp;&amp;amp; $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 和 $y 都为 true，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_and2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;||&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;或&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x || $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 和 $y 至少有一个为 true，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_or2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;!&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;非&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;!$x&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 不为 true，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_not&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 数组运算符&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 数组运算符用于比较数组：&lt;/p&gt;&lt;table class=&quot;dataintable&quot; width=&quot;810&quot;&gt;&lt;tbody style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot; class=&quot;firstRow&quot;&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 59.8906px;&quot;&gt;运算符&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 100.344px;&quot;&gt;名称&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 100.344px;&quot;&gt;例子&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255); width: 383.5px;&quot;&gt;结果&lt;/th&gt;&lt;th style=&quot;margin: 0px; padding-top: 10px; padding-bottom: 10px; border-color: rgb(63, 63, 63); vertical-align: baseline; background-color: rgb(63, 63, 63); text-align: left; color: rgb(255, 255, 255);&quot;&gt;显示结果&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;+&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;联合&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x + $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x 和 $y 的联合（但不覆盖重复的键）&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_union&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;==&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;相等&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x == $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 和 $y 拥有相同的键/值对，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_equality&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;===&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;全等&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x === $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 和 $y 拥有相同的键/值对，且顺序相同类型相同，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_identity&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;!=&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;不相等&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x != $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 不等于 $y，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_inequality&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(255, 255, 255);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&amp;lt;&amp;gt;&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;不相等&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x &amp;lt;&amp;gt; $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 不等于 $y，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_inequality2&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;margin: 0px; padding: 0px; border: 0px; background-color: rgb(245, 245, 245);&quot;&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;!==&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;不全等&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;$x !== $y&lt;/td&gt;&lt;td style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;如果 $x 与 $y 完全不同，则返回 true。&lt;/td&gt;&lt;td class=&quot;tiy&quot; style=&quot;margin: 0px; padding: 9px; border-color: rgb(170, 170, 170); vertical-align: text-top;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_operator_non_identity&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;显示结果&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例展示了使用不同数组运算符的不同结果：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$x&amp;nbsp;=&amp;nbsp;array(&amp;quot;a&amp;quot;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;apple&amp;quot;,&amp;nbsp;&amp;quot;b&amp;quot;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;banana&amp;quot;);&amp;nbsp;
$y&amp;nbsp;=&amp;nbsp;array(&amp;quot;c&amp;quot;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;orange&amp;quot;,&amp;nbsp;&amp;quot;d&amp;quot;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;peach&amp;quot;);&amp;nbsp;
$z&amp;nbsp;=&amp;nbsp;$x&amp;nbsp;+&amp;nbsp;$y;&amp;nbsp;//&amp;nbsp;$x&amp;nbsp;与&amp;nbsp;$y&amp;nbsp;的联合var_dump($z);
var_dump($x&amp;nbsp;==&amp;nbsp;$y);
var_dump($x&amp;nbsp;===&amp;nbsp;$y);
var_dump($x&amp;nbsp;!=&amp;nbsp;$y);
var_dump($x&amp;nbsp;&amp;lt;&amp;gt;&amp;nbsp;$y);
var_dump($x&amp;nbsp;!==&amp;nbsp;$y);?&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:28:36 +0800</pubDate></item><item><title>PHP 常量</title><link>https://0977a.cn/?id=14</link><description>&lt;div id=&quot;intro&quot; style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: 微软雅黑; color: rgb(63, 63, 63); font-weight: bold; font-size: 16px; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 24px;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;常量类似变量，但是常量一旦被定义就无法更改或撤销定义。&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 常量&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;常量是单个值的标识符（名称）。在脚本中无法改变该值。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;有效的常量名以字符或下划线开头（常量名称前面没有 $ 符号）。&lt;/p&gt;&lt;p class=&quot;note&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;注释：&lt;/span&gt;与变量不同，常量贯穿整个脚本是自动全局的。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;设置 PHP 常量&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;如需设置常量，请使用&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px 4px; border: 0px; color: crimson; background-color: rgb(241, 241, 241); font-family: Consolas, &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: 15.4px;&quot;&gt;define()&lt;/code&gt;&amp;nbsp;函数 - 它使用三个参数：&lt;/p&gt;&lt;ol style=&quot;margin-top: 15px; margin-bottom: 20px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;首个参数定义常量的名称&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;第二个参数定义常量的值&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;可选的第三个参数规定常量名是否对大小写不敏感。默认是 false。&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例创建了一个&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;对大小写敏感的常量&lt;/span&gt;，值为 &amp;quot;Welcome to W3School.com.cn!&amp;quot;：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpdefine(&amp;quot;GREETING&amp;quot;,&amp;nbsp;&amp;quot;Welcome&amp;nbsp;to&amp;nbsp;W3School.com.cn!&amp;quot;);echo&amp;nbsp;GREETING;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_constant1&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例创建了一个&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;对大小写不敏感的常量&lt;/span&gt;，值为 &amp;quot;Welcome to W3School.com.cn!&amp;quot;：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpdefine(&amp;quot;GREETING&amp;quot;,&amp;nbsp;&amp;quot;Welcome&amp;nbsp;to&amp;nbsp;W3School.com.cn!&amp;quot;,&amp;nbsp;true);echo&amp;nbsp;greeting;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_constant2&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;常量是全局的&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;常量是自动全局的，而且可以贯穿整个脚本使用。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下面的例子在函数内使用了一个常量，即使它在函数外定义：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpdefine(&amp;quot;GREETING&amp;quot;,&amp;nbsp;&amp;quot;Welcome&amp;nbsp;to&amp;nbsp;W3School.com.cn!&amp;quot;);function&amp;nbsp;myTest()&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;GREETING;
}
&amp;nbsp;
myTest();?&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:28:18 +0800</pubDate></item><item><title>PHP 字符串函数</title><link>https://0977a.cn/?id=13</link><description>&lt;div id=&quot;intro&quot; style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: 微软雅黑; color: rgb(63, 63, 63); font-weight: bold; font-size: 16px; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 24px;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;字符串是字符序列，比如 &amp;quot;Hello world!&amp;quot;。&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 字符串函数&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在本节中，我们将学习常用的字符串操作函数。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP strlen() 函数&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;strlen() 函数返回字符串的长度，以字符计。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例返回字符串 &amp;quot;Hello world!&amp;quot; 的长度：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpecho&amp;nbsp;strlen(&amp;quot;Hello&amp;nbsp;world!&amp;quot;);?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_datatypes_length&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;以上代码的输出是：12&lt;/p&gt;&lt;p class=&quot;tip&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold; color: #FF9955;&quot;&gt;提示：&lt;/span&gt;strlen() 常用于循环和其他函数，在确定字符串何时结束很重要时。（例如，在循环中，我们也许需要在字符串的最后一个字符之后停止循环）。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;对字符串中的单词计数&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP str_word_count() 函数对字符串中的单词进行计数：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpecho&amp;nbsp;str_word_count(&amp;quot;Hello&amp;nbsp;world!&amp;quot;);&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;2?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_string_word_count&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;以上代码的输出：&lt;/p&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;2&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;反转字符串&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP strrev() 函数反转字符串：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpecho&amp;nbsp;strrev(&amp;quot;Hello&amp;nbsp;world!&amp;quot;);&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;!dlrow&amp;nbsp;olleH?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_string_reverse&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;以上代码的输出：&lt;/p&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;!dlrow&amp;nbsp;olleH&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP strpos() 函数&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;strpos() 函数用于检索字符串内指定的字符或文本。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;如果找到匹配，则会返回首个匹配的字符位置。如果未找到匹配，则将返回 FALSE。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下例检索字符串 &amp;quot;Hello world!&amp;quot; 中的文本 &amp;quot;world&amp;quot;：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpecho&amp;nbsp;strpos(&amp;quot;Hello&amp;nbsp;world!&amp;quot;,&amp;quot;world&amp;quot;);?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_datatypes_pos&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;以上代码的输出是：6。&lt;/p&gt;&lt;p class=&quot;tip&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold; color: #FF9955;&quot;&gt;提示：&lt;/span&gt;上例中字符串 &amp;quot;world&amp;quot; 的位置是 6。是 6（而不是 7）的理由是，字符串中首字符的位置是 0 而不是 1。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;替换字符串中的文本&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP str_replace() 函数用一些字符串替换字符串中的另一些字符。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下面的例子用 &amp;quot;Kitty&amp;quot; 替换文本 &amp;quot;world&amp;quot;：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpecho&amp;nbsp;str_replace(&amp;quot;world&amp;quot;,&amp;nbsp;&amp;quot;Kitty&amp;quot;,&amp;nbsp;&amp;quot;Hello&amp;nbsp;world!&amp;quot;);&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;Hello&amp;nbsp;Kitty!?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_string_replace&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;以上代码的输出是：&lt;/p&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;Hello&amp;nbsp;Kitty!&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:27:55 +0800</pubDate></item><item><title>PHP 数据类型</title><link>https://0977a.cn/?id=12</link><description>&lt;div id=&quot;intro&quot; style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: 微软雅黑; color: rgb(63, 63, 63); font-weight: bold; font-size: 16px; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 24px;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;字符串、整数、浮点数、逻辑、数组、对象、NULL。&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 字符串&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;字符串是字符序列，比如 &amp;quot;Hello world!&amp;quot;。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;字符串可以是引号内的任何文本。您可以使用单引号或双引号：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php&amp;nbsp;$x&amp;nbsp;=&amp;nbsp;&amp;quot;Hello&amp;nbsp;world!&amp;quot;;echo&amp;nbsp;$x;echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;&amp;nbsp;
$x&amp;nbsp;=&amp;nbsp;&amp;#39;Hello&amp;nbsp;world!&amp;#39;;echo&amp;nbsp;$x;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_datatypes_string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 整数&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;整数是没有小数的数字。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;整数规则：&lt;/p&gt;&lt;ul style=&quot;margin-top: 15px; margin-bottom: 20px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;整数必须有至少一个数字（0-9）&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;整数不能包含逗号或空格&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;整数不能有小数点&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;整数正负均可&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;可以用三种格式规定整数：十进制、十六进制（前缀是 0x）或八进制（前缀是 0）&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在下面的例子中，我们将测试不同的数字。PHP var_dump() 会返回变量的数据类型和值：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php&amp;nbsp;$x&amp;nbsp;=&amp;nbsp;5985;
var_dump($x);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;&amp;nbsp;
$x&amp;nbsp;=&amp;nbsp;-345;&amp;nbsp;//&amp;nbsp;负数var_dump($x);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;&amp;nbsp;
$x&amp;nbsp;=&amp;nbsp;0x8C;&amp;nbsp;//&amp;nbsp;十六进制数var_dump($x);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;
$x&amp;nbsp;=&amp;nbsp;047;&amp;nbsp;//&amp;nbsp;八进制数var_dump($x);?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_datatypes_integer&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 浮点数&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;浮点数是有小数点或指数形式的数字。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在下面的例子中，我们将测试不同的数字。PHP var_dump() 会返回变量的数据类型和值：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php&amp;nbsp;$x&amp;nbsp;=&amp;nbsp;10.365;
var_dump($x);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;&amp;nbsp;
$x&amp;nbsp;=&amp;nbsp;2.4e3;
var_dump($x);echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;&amp;nbsp;
$x&amp;nbsp;=&amp;nbsp;8E-5;
var_dump($x);?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_datatypes_float&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 逻辑&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;逻辑是 true 或 false。&lt;/p&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;$x=true;
$y=false;&lt;/pre&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;逻辑常用于条件测试。您将在本教程稍后的章节学到更多有关条件测试的知识。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 数组&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;数组在一个变量中存储多个值。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在下面的例子中，我们将测试不同的数组。PHP var_dump() 会返回变量的数据类型和值：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php&amp;nbsp;$cars=array(&amp;quot;Volvo&amp;quot;,&amp;quot;BMW&amp;quot;,&amp;quot;SAAB&amp;quot;);
var_dump($cars);?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_datatypes_array&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;您将在本教程稍后的章节学到更多有关数组的知识。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 对象&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;对象是存储数据和有关如何处理数据的信息的数据类型。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在 PHP 中，必须明确地声明对象。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;首先我们必须声明对象的类。对此，我们使用 class 关键词。类是包含属性和方法的结构。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;然后我们在对象类中定义数据类型，然后在该类的实例中使用此数据类型：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpclass&amp;nbsp;Car
{&amp;nbsp;&amp;nbsp;var&amp;nbsp;$color;&amp;nbsp;&amp;nbsp;function&amp;nbsp;Car($color=&amp;quot;green&amp;quot;)&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$this-&amp;gt;color&amp;nbsp;=&amp;nbsp;$color;
&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;function&amp;nbsp;what_color()&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;$this-&amp;gt;color;
&amp;nbsp;&amp;nbsp;}
}?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_datatypes_object&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;您将在本教程稍后的章节学到更多有关对象的知识。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP NULL 值&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;特殊的 NULL 值表示变量无值。NULL 是数据类型 NULL 唯一可能的值。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;NULL 值标示变量是否为空。也用于区分空字符串与空值数据库。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;可以通过把值设置为 NULL，将变量清空：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$x=&amp;quot;Hello&amp;nbsp;world!&amp;quot;;
$x=null;
var_dump($x);?&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:27:16 +0800</pubDate></item><item><title>PHP 5 echo 和 print 语句</title><link>https://0977a.cn/?id=11</link><description>&lt;div id=&quot;intro&quot; style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: 微软雅黑; color: rgb(63, 63, 63); font-weight: bold; font-size: 16px; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 24px;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;在 PHP 中，有两种基本的输出方法：echo 和 print。&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 24px;&quot;&gt;在本教程中，我们几乎在每个例子中都会用到 echo 和 print。因此，本节为您讲解更多关于这两条输出语句的知识。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP echo 和 print 语句&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;echo 和 print 之间的差异：&lt;/p&gt;&lt;ul style=&quot;margin-top: 15px; margin-bottom: 20px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;echo - 能够输出一个以上的字符串&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;print - 只能输出一个字符串，并始终返回 1&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;tip&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold; color: #FF9955;&quot;&gt;提示：&lt;/span&gt;echo 比 print 稍快，因为它不返回任何值。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP echo 语句&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;echo 是一个语言结构，有无括号均可使用：echo 或 echo()。&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;显示字符串&lt;/h3&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下面的例子展示如何用 echo 命令来显示不同的字符串（同时请注意字符串中能包含 HTML 标记）：&lt;/p&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpecho&amp;nbsp;&amp;quot;&amp;lt;h2&amp;gt;PHP&amp;nbsp;is&amp;nbsp;fun!&amp;lt;/h2&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;Hello&amp;nbsp;world!&amp;lt;br&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;I&amp;#39;m&amp;nbsp;about&amp;nbsp;to&amp;nbsp;learn&amp;nbsp;PHP!&amp;lt;br&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;This&amp;quot;,&amp;nbsp;&amp;quot;&amp;nbsp;string&amp;quot;,&amp;nbsp;&amp;quot;&amp;nbsp;was&amp;quot;,&amp;nbsp;&amp;quot;&amp;nbsp;made&amp;quot;,&amp;nbsp;&amp;quot;&amp;nbsp;with&amp;nbsp;multiple&amp;nbsp;parameters.&amp;quot;;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_echo1&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;显示变量&lt;/h3&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下面的例子展示如何用 echo 命令来显示字符串和变量：&lt;/p&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$txt1=&amp;quot;Learn&amp;nbsp;PHP&amp;quot;;
$txt2=&amp;quot;W3School.com.cn&amp;quot;;
$cars=array(&amp;quot;Volvo&amp;quot;,&amp;quot;BMW&amp;quot;,&amp;quot;SAAB&amp;quot;);echo&amp;nbsp;$txt1;echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;Study&amp;nbsp;PHP&amp;nbsp;at&amp;nbsp;$txt2&amp;quot;;echo&amp;nbsp;&amp;quot;My&amp;nbsp;car&amp;nbsp;is&amp;nbsp;a&amp;nbsp;{$cars[0]}&amp;quot;;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_echo2&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP print 语句&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;print 也是语言结构，有无括号均可使用：print 或 print()。&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;显示字符串&lt;/h3&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下面的例子展示如何用 print 命令来显示不同的字符串（同时请注意字符串中能包含 HTML 标记）：&lt;/p&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpprint&amp;nbsp;&amp;quot;&amp;lt;h2&amp;gt;PHP&amp;nbsp;is&amp;nbsp;fun!&amp;lt;/h2&amp;gt;&amp;quot;;print&amp;nbsp;&amp;quot;Hello&amp;nbsp;world!&amp;lt;br&amp;gt;&amp;quot;;print&amp;nbsp;&amp;quot;I&amp;#39;m&amp;nbsp;about&amp;nbsp;to&amp;nbsp;learn&amp;nbsp;PHP!&amp;quot;;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_print&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;显示变量&lt;/h3&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下面的例子展示如何用 print 命令来显示字符串和变量：&lt;/p&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$txt1=&amp;quot;Learn&amp;nbsp;PHP&amp;quot;;
$txt2=&amp;quot;W3School.com.cn&amp;quot;;
$cars=array(&amp;quot;Volvo&amp;quot;,&amp;quot;BMW&amp;quot;,&amp;quot;SAAB&amp;quot;);print&amp;nbsp;$txt1;print&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;print&amp;nbsp;&amp;quot;Study&amp;nbsp;PHP&amp;nbsp;at&amp;nbsp;$txt2&amp;quot;;print&amp;nbsp;&amp;quot;My&amp;nbsp;car&amp;nbsp;is&amp;nbsp;a&amp;nbsp;{$cars[0]}&amp;quot;;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_print2&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:26:22 +0800</pubDate></item><item><title>PHP 变量</title><link>https://0977a.cn/?id=10</link><description>&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;变量是存储信息的容器：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$x=5;
$y=6;
$z=$x+$y;echo&amp;nbsp;$z;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_var1&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;类似代数&lt;/h2&gt;&lt;pre style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;x=5
y=6
z=x+y&lt;/pre&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在代数中我们使用字母（比如 x）来保存值（比如 5）。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;从上面的表达式 z=x+y，我们能够计算出 z 的值是 11。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在 PHP 中，这三个字母被称为&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;变量&lt;/span&gt;。&lt;/p&gt;&lt;p class=&quot;note&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;注释：&lt;/span&gt;请把变量视为存储数据的容器。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 变量&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;正如代数，PHP 变量可用于保存值（x=5）和表达式（z=x+y）。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;变量的名称可以很短（比如 x 和 y），也可以取更具描述性的名称（比如 carname、total_volume）。&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;PHP 变量规则：&lt;/h3&gt;&lt;ul style=&quot;margin-top: 15px; margin-bottom: 20px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;变量以 $ 符号开头，其后是变量的名称&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;变量名称必须以字母或下划线开头&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;变量名称不能以数字开头&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;变量名称只能包含字母数字字符和下划线（A-z、0-9 以及 _）&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;变量名称对大小写敏感（$y 与 $Y 是两个不同的变量）&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;note&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;注释：&lt;/span&gt;PHP 变量名称对大小写敏感！&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;创建 PHP 变量&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 没有创建变量的命令。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;变量会在首次为其赋值时被创建：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$txt=&amp;quot;Hello&amp;nbsp;world!&amp;quot;;
$x=5;
$y=10.5;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_var2&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;以上语句执行后，变量 txt 会保存值 Hello world!，变量 x 会保存值 5，变量 y 会保存值 10.5。&lt;/p&gt;&lt;p class=&quot;note&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;注释：&lt;/span&gt;如果您为变量赋的值是文本，请用引号包围该值。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 是一门类型松散的语言&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在上面的例子中，请注意我们不必告知 PHP 变量的数据类型。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 根据它的值，自动把变量转换为正确的数据类型。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在诸如 C 和 C++ 以及 Java 之类的语言中，程序员必须在使用变量之前声明它的名称和类型。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 变量作用域&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在 PHP 中，可以在脚本的任意位置对变量进行声明。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;变量的作用域指的是变量能够被引用/使用的那部分脚本。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 有三种不同的变量作用域：&lt;/p&gt;&lt;ul style=&quot;margin-top: 15px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;local（局部）&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;global（全局）&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;static（静态）&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;Local 和 Global 作用域&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;函数&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;之外&lt;/span&gt;声明的变量拥有 Global 作用域，只能在函数以外进行访问。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;函数&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;内部&lt;/span&gt;声明的变量拥有 LOCAL 作用域，只能在函数内部进行访问。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下面的例子测试了带有局部和全局作用域的变量：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$x=5;&amp;nbsp;//&amp;nbsp;全局作用域function&amp;nbsp;myTest()&amp;nbsp;{
&amp;nbsp;&amp;nbsp;$y=10;&amp;nbsp;//&amp;nbsp;局部作用域&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;&amp;lt;p&amp;gt;测试函数内部的变量：&amp;lt;/p&amp;gt;&amp;quot;;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;变量&amp;nbsp;x&amp;nbsp;是：$x&amp;quot;;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&amp;quot;变量&amp;nbsp;y&amp;nbsp;是：$y&amp;quot;;
}&amp;nbsp;

myTest();echo&amp;nbsp;&amp;quot;&amp;lt;p&amp;gt;测试函数之外的变量：&amp;lt;/p&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;变量&amp;nbsp;x&amp;nbsp;是：$x&amp;quot;;echo&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;变量&amp;nbsp;y&amp;nbsp;是：$y&amp;quot;;?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_var_local&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在上例中，有两个变量 $x 和 $y，以及一个函数 myTest()。$x 是全局变量，因为它是在函数之外声明的，而 $y 是局部变量，因为它是在函数内声明的。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;如果我们在 myTest() 函数内部输出两个变量的值，$y 会输出在本地声明的值，但是无法 $x 的值，因为它在函数之外创建。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;然后，如果在 myTest() 函数之外输出两个变量的值，那么会输出 $x 的值，但是不会输出 $y 的值，因为它是局部变量，并且在 myTest() 内部创建。&lt;/p&gt;&lt;p class=&quot;note&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;注释：&lt;/span&gt;您可以在不同的函数中创建名称相同的局部变量，因为局部变量只能被在其中创建它的函数识别。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP global 关键词&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;global 关键词用于在函数内访问全局变量。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;要做到这一点，请在（函数内部）变量前面使用 global 关键词：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$x=5;
$y=10;function&amp;nbsp;myTest()&amp;nbsp;{global$x,$y;
&amp;nbsp;&amp;nbsp;$y=$x+$y;
}

myTest();echo&amp;nbsp;$y;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;15?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_var_global&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 同时在名为 $GLOBALS[index] 的数组中存储了所有的全局变量。下标存有变量名。这个数组在函数内也可以访问，并能够用于直接更新全局变量。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;上面的例子可以这样重写：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php$x=5;
$y=10;function&amp;nbsp;myTest()&amp;nbsp;{&amp;nbsp;&amp;nbsp;$GLOBALS[&amp;#39;y&amp;#39;]=$GLOBALS[&amp;#39;x&amp;#39;]+$GLOBALS[&amp;#39;y&amp;#39;];
}&amp;nbsp;

myTest();echo&amp;nbsp;$y;&amp;nbsp;//&amp;nbsp;输出&amp;nbsp;15?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_var_global2&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP static 关键词&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;通常，当函数完成/执行后，会删除所有变量。不过，有时我需要不删除某个局部变量。实现这一点需要更进一步的工作。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;要完成这一点，请在您首次声明变量时使用&amp;nbsp;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;static&lt;/span&gt;&amp;nbsp;关键词：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?phpfunction&amp;nbsp;myTest()&amp;nbsp;{static$x=0;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;$x;
&amp;nbsp;&amp;nbsp;$x++;
}

myTest();
myTest();
myTest();?&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_var_static&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;然后，每当函数被调用时，这个变量所存储的信息都是函数最后一次被调用时所包含的信息。&lt;/p&gt;&lt;p class=&quot;note&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;注释：&lt;/span&gt;该变量仍然是函数的局部变量。&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:25:51 +0800</pubDate></item><item><title>PHP 语法</title><link>https://0977a.cn/?id=9</link><description>&lt;div id=&quot;intro&quot; style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: 微软雅黑; color: rgb(63, 63, 63); font-weight: bold; font-size: 16px; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;p style=&quot;margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 24px;&quot;&gt;&lt;strong style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;PHP 脚本在服务器上执行，然后向浏览器发送回纯 HTML 结果。&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;基础 PHP 语法&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 脚本可放置于文档中的任何位置。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 脚本以&amp;nbsp;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt;&amp;nbsp;开头，以&amp;nbsp;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;结尾：&lt;/p&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;?php//&amp;nbsp;此处是&amp;nbsp;PHP&amp;nbsp;代码?&amp;gt;&lt;/pre&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 文件的默认文件扩展名是 &amp;quot;.php&amp;quot;。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 文件通常包含 HTML 标签以及一些 PHP 脚本代码。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;下面的例子是一个简单的 PHP 文件，其中包含了使用内建 PHP 函数 &amp;quot;echo&amp;quot; 在网页上输出文本 &amp;quot;Hello World!&amp;quot; 的一段 PHP 脚本：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;!DOCTYPE&amp;nbsp;html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;我的第一张&amp;nbsp;PHP&amp;nbsp;页面&amp;lt;/h1&amp;gt;&amp;lt;?phpecho&amp;nbsp;&amp;quot;Hello&amp;nbsp;World!&amp;quot;;?&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_syntax&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;note&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold;&quot;&gt;注释：&lt;/span&gt;PHP 语句以分号结尾（;）。PHP 代码块的关闭标签也会自动表明分号（因此在 PHP 代码块的最后一行不必使用分号）。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 中的注释&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;PHP 代码中的注释不会被作为程序来读取和执行。它唯一的作用是供代码编辑者阅读。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;注释用于：&lt;/p&gt;&lt;ul style=&quot;margin-top: 15px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;使其他人理解您正在做的工作 - 注释可以让其他程序员了解您在每个步骤进行的工作（如果您供职于团队）&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;提醒自己做过什么 - 大多数程序员都曾经历过一两年后对项目进行返工，然后不得不重新考虑他们做过的事情。注释可以记录您在写代码时的思路。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 支持三种注释：&lt;/h2&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;!DOCTYPE&amp;nbsp;html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;?php//&amp;nbsp;这是单行注释#&amp;nbsp;这也是单行注释

/*
这是多行注释块
它横跨了
多行
*/
?&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_syntax_comments&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;PHP 大小写敏感&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在 PHP 中，所有用户定义的函数、类和关键词（例如 if、else、echo 等等）都对大小写不敏感。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在下面的例子中，所有这三条 echo 语句都是合法的（等价）：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;!DOCTYPE&amp;nbsp;html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;?phpECHO&amp;nbsp;&amp;quot;Hello&amp;nbsp;World!&amp;lt;br&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;Hello&amp;nbsp;World!&amp;lt;br&amp;gt;&amp;quot;;EcHo&amp;nbsp;&amp;quot;Hello&amp;nbsp;World!&amp;lt;br&amp;gt;&amp;quot;;?&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;p class=&quot;tiy&quot; style=&quot;margin-top: 15px; margin-bottom: 10px; padding: 8px 18px; border: none; line-height: 21px; display: inline-block; outline: 0px; vertical-align: middle; overflow: hidden; color: rgb(255, 255, 255); background-color: rgb(233, 104, 107); text-align: center; transition: all 0.2s ease-out 0s; cursor: pointer; white-space: nowrap; box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 6px, rgba(0, 0, 0, 0.24) 0px 1px 2px; font-family: 微软雅黑; border-radius: 2px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://www.w3school.com.cn/tiy/s.asp?f=demo_php_syntax_case1&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; text-decoration-line: none; color: rgb(255, 255, 255); background: transparent;&quot;&gt;运行实例&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;不过在 PHP 中，所有变量都对大小写敏感。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;在下面的例子中，只有第一条语句会显示 $color 变量的值（这是因为 $color、$COLOR 以及 $coLOR 被视作三个不同的变量）：&lt;/p&gt;&lt;h3 style=&quot;margin: 25px 0px 0px; padding: 0px; border: 0px; font-size: 15px;&quot;&gt;实例&lt;/h3&gt;&lt;pre class=&quot;htmlHigh&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 20px; border: 1px solid rgb(221, 221, 221); width: 765px; background-color: rgb(255, 254, 252); line-height: 1.5; font-family: Consolas, 微软雅黑, &amp;quot;Source Code Pro&amp;quot;, Menlo, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace, PingFangSC-Regular, 宋体; overflow-x: auto;&quot;&gt;&amp;lt;!DOCTYPE&amp;nbsp;html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;?php$color=&amp;quot;red&amp;quot;;echo&amp;nbsp;&amp;quot;My&amp;nbsp;car&amp;nbsp;is&amp;nbsp;&amp;quot;&amp;nbsp;.&amp;nbsp;$color&amp;nbsp;.&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;My&amp;nbsp;house&amp;nbsp;is&amp;nbsp;&amp;quot;&amp;nbsp;.&amp;nbsp;$COLOR&amp;nbsp;.&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;echo&amp;nbsp;&amp;quot;My&amp;nbsp;boat&amp;nbsp;is&amp;nbsp;&amp;quot;&amp;nbsp;.&amp;nbsp;$coLOR&amp;nbsp;.&amp;nbsp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;;?&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:21:32 +0800</pubDate></item><item><title>PHP 安装</title><link>https://0977a.cn/?id=8</link><description>&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;我需要什么？&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;如需开始使用 PHP，您可以：&lt;/p&gt;&lt;ul style=&quot;margin-top: 15px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;使用支持 PHP 和 MySQL 的 web 主机&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;在您的 PC 上安装 web 服务器，然后安装 PHP 和 MySQL。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;使用支持 PHP 的 Web 主机&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;如果您的服务器支持 PHP，那么您无需做任何事情。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;只要创建 .php 文件，然后上传到 web 目录中即可。服务器会自动对它们进行解析。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;您无需编译或安装任何额外的工具。&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;因为 PHP 是免费的，大多数 web 主机都支持 PHP。&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;在您的 PC 上运行 PHP&lt;/h2&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;不过如果您的服务器不支持 PHP，那么您必须：&lt;/p&gt;&lt;ul style=&quot;margin-top: 15px; margin-bottom: 20px; margin-left: 35px; padding: 0px; border: 0px; line-height: 21px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;安装 web 服务器&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;安装 PHP&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;安装数据库，比如 MySQL&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;官方的 PHP 网站 (PHP.net) 提供了 PHP 的安装说明：&lt;a target=&quot;_blank&quot; href=&quot;http://php.net/manual/zh/install.php&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;http://php.net/manual/zh/install.php&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style=&quot;margin: 0px 0px 0px 25px; padding: 30px 0px 32px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(170, 170, 170); border-left-color: initial; border-image: initial; width: 810px; font-family: &amp;quot;SF Pro SC&amp;quot;, &amp;quot;SF Pro Text&amp;quot;, &amp;quot;SF Pro Icons&amp;quot;, &amp;quot;PingFang SC&amp;quot;, Verdana, Arial, 微软雅黑, 宋体; white-space: normal; background-color: rgb(253, 252, 248);&quot;&gt;&lt;h2 style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 18px; color: rgb(63, 63, 63); font-family: 微软雅黑;&quot;&gt;注释&lt;/h2&gt;&lt;p class=&quot;tip&quot; style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-weight: bold; color: #FF9955;&quot;&gt;提示：&lt;/span&gt;如需在 Windows 平台设置并立即运行 PHP，您还可以：&lt;/p&gt;&lt;p style=&quot;margin-top: 15px; margin-bottom: 0px; padding: 0px; border: 0px; line-height: 21px;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://www.microsoft.com/web/webmatrix/&quot; style=&quot;margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(144, 11, 9); border-left-color: initial; border-image: initial; text-decoration-line: none; color: rgb(144, 11, 9); background: transparent;&quot;&gt;下载 WebMatrix&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 10 Jan 2023 09:21:20 +0800</pubDate></item></channel></rss>