PHP and or not
In program operations, values are converted into machine codes (binary) and then added, and AND or NOT are based on this basis and are operated in binary.
with $
1$0=0
or |
1|0=1
Not ~
~1=0
<code><span><?php </span><span>//四个变量分别代表四盏灯的开关</span><span>$l_one</span> = <span>1</span>; <span>$l_two</span> = <span>2</span>; <span>$l_three</span> = <span>4</span>; <span>$l_four</span> = <span>8</span>; <span>//$sta代表四盏灯的状态</span><span>$sta</span> = <span>3</span>; <span>//输出灯开的号码</span> light_sta(<span>$sta</span>); <span>//若要开启第四盏灯</span><span>echo</span><span>'开启第四盏灯:'</span>; <span>$sta_n</span> = <span>$sta</span>|<span>$l_four</span>; light_sta(<span>$sta_n</span>); <span>//若要关闭第一盏灯</span><span>echo</span><span>'关闭第一盏灯:'</span>; <span>$sta_o</span> = <span>$sta</span>&~<span>$l_one</span>; light_sta(<span>$sta_o</span>); <span>//输出灯开的号码</span><span><span>function</span><span>light_sta</span><span>(<span>$sta</span>)</span>{</span><span>//四个变量分别代表四盏灯的开关</span><span>$l_one</span> = <span>1</span>; <span>$l_two</span> = <span>2</span>; <span>$l_three</span> = <span>4</span>; <span>$l_four</span> = <span>8</span>; <span>echo</span><span>'light on: '</span>; <span>if</span>(<span>$sta</span>&<span>$l_one</span>){ <span>echo</span><span>'1 '</span>; }<span>if</span>(<span>$sta</span>&<span>$l_two</span>){ <span>echo</span><span>'2 '</span>; }<span>if</span>(<span>$sta</span>&<span>$l_three</span>){ <span>echo</span><span>'3 '</span>; }<span>if</span>(<span>$sta</span>&<span>$l_four</span>){ <span>echo</span><span>'4'</span>; } <span>echo</span><span>''</span>; }</span></code>
The above has introduced the pros and cons of PHP, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

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

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

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



STA has different meanings in different fields, namely: 1. In Wi-Fi networks, STA represents terminal equipment or client equipment; 2. In the IEEE 802.11 standard, STA refers to terminal equipment in wireless networks; 3. In the tourism industry, STA stands for short-term accommodation; 4. In schools, STA stands for student examination administration; 5. In statistics, STA stands for statistical analysis. STA as an abbreviation may have other meanings in different fields, and the specific meaning should be interpreted according to the context and the background of the specific field.

In today's era of rapid technological development, programming languages are springing up like mushrooms after a rain. One of the languages that has attracted much attention is the Go language, which is loved by many developers for its simplicity, efficiency, concurrency safety and other features. The Go language is known for its strong ecosystem with many excellent open source projects. This article will introduce five selected Go language open source projects and lead readers to explore the world of Go language open source projects. KubernetesKubernetes is an open source container orchestration engine for automated

"Go Language Development Essentials: 5 Popular Framework Recommendations" As a fast and efficient programming language, Go language is favored by more and more developers. In order to improve development efficiency and optimize code structure, many developers choose to use frameworks to quickly build applications. In the world of Go language, there are many excellent frameworks to choose from. This article will introduce 5 popular Go language frameworks and provide specific code examples to help readers better understand and use these frameworks. 1.GinGin is a lightweight web framework with fast

What is AMP Coin? The AMP token was created by the Synereo team in 2015 as the main trading currency of the Synereo platform. AMP token aims to provide users with a better digital economic experience through multiple functions and uses. Purpose of AMP Token The AMP Token has multiple roles and functions in the Synereo platform. First, as part of the platform’s cryptocurrency reward system, users are able to earn AMP rewards by sharing and promoting content, a mechanism that encourages users to participate more actively in the platform’s activities. AMP tokens can also be used to promote and distribute content on the Synereo platform. Users can increase the visibility of their content on the platform by using AMP tokens to attract more viewers to view and share

With the development of the Internet and the advancement of information technology, the era of big data has arrived, and fields such as data analysis and machine learning have also been widely used. In these fields, task scheduling is an inevitable problem. How to achieve efficient task scheduling is crucial to improving efficiency. In this article, we will introduce how to use Golang's web framework Echo framework to implement distributed task scheduling. 1. Introduction to the Echo framework Echo is a high-performance, scalable, lightweight GoWeb framework. It is based on HTTP

Laravel is a popular PHP framework that is highly scalable and efficient. It provides many powerful tools and libraries that allow developers to quickly build high-quality web applications. Among them, LaravelEcho and Pusher are two very important tools through which WebSockets communication can be easily implemented. This article will detail how to use these two tools in Laravel applications. What are WebSockets? WebSockets

Detailed explanation of the role and usage of the echo keyword in PHP PHP is a widely used server-side scripting language, which is widely used in web development. The echo keyword is a method used to output content in PHP. This article will introduce in detail the function and use of the echo keyword. Function: The main function of the echo keyword is to output content to the browser. In web development, we need to dynamically present data to the front-end page. At this time, we can use the echo keyword to output the data to the page. e

As a fast and efficient programming language, Go language has always been favored by programmers. In the Go language ecosystem, frameworks play a vital role in helping developers build applications faster. This article will introduce five Go language frameworks to let you understand their characteristics and usage. 1. Gin framework The Gin framework is a lightweight Web framework with fast and high performance characteristics. Use the Gin framework to quickly build RESTful APIs and web applications. Here is a simple example code:
