Home Backend Development PHP Tutorial PHP Mobile Internet Development Notes (3) - Operator_PHP Tutorial

PHP Mobile Internet Development Notes (3) - Operator_PHP Tutorial

Jul 13, 2016 am 10:35 AM
Getting started with php internet process operator

1. PHP operators

There is a rich set of operators in PHP, most of which come directly from the C language. According to different functions, operators can be divided into: arithmetic operators, string operators, assignment operators, bit operators, conditional operators, and logical operators. When various operators are in the same expression, their operations have a certain priority.

(1) Arithmetic operations

+ - * / % ++ --

(2) String operator

There is only one string operator. (dot) is the English period. It can concatenate strings to form a new string, or it can concatenate strings with numbers, and the types will be automatically converted.

	$a="dawanganban";  
$b="123";  
echo $a.$b;   //输出结果:dawanganban123  
Copy after login
(3) Assignment operator

	= += -= *= /= %= .=



$a="dawanganban";  
$a.=1;  
$a.=2;  
$a.=3;  
echo $a.$b;   //输出结果:dawanganban123  
Copy after login
(4) Bit operators ​ & | ~ ^ << >>

(5) Comparison operators

> < >= <= == != <> === !==

<>: is not equal to sum! =Same

===: Identity, the values ​​are equal and the types are consistent

! ==: non-identity, values ​​are not equal or types are inconsistent

  1. 	echo 5 == "5"; //true  PHP是弱类型语言(js中的变量类似)  
    echo 5 === "5";  //false  完全等于  
    Copy after login
(6) Logical operations

AND (logical AND) OR (logical OR) XOR (logical exclusive OR) && (logical AND) || (logical OR) ! (logical NOT)

	var_dump(5 && "");   //false  
var_dump(5 && "2"); //true  
var_dump(5 || ""); //true  
var_dump(0 xor 1); //true  
var_dump(0 xor 0); //false  
var_dump(1 xor 1); //false  
Copy after login


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/746361.htmlTechArticle1. PHP operators PHP has a rich set of operators, most of which come directly from the C language . According to different functions, operators can be divided into: arithmetic operators, string operations...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
How to Show Internet Speed ​​on Taskbar [Easy Steps] How to Show Internet Speed ​​on Taskbar [Easy Steps] Aug 01, 2023 pm 05:22 PM

Internet speed is an important parameter in determining the outcome of your online experience. Whether downloading or uploading files or just browsing the web, we all need a decent internet connection. This is why users look for ways to display internet speed on the taskbar. Displaying network speed in the taskbar allows users to monitor things quickly, no matter the task at hand. The taskbar is always visible unless you are in full screen mode. But Windows doesn't offer a native option to display internet speed in the taskbar. That's why you need third-party tools. Read on to learn all about the best options! How to run a speed test from the Windows command line? Press + to open Run, type power shell, and press ++. Window

Fix: Network connection issue that prevents access to the Internet in Windows 11 Safe Mode Fix: Network connection issue that prevents access to the Internet in Windows 11 Safe Mode Sep 23, 2023 pm 01:13 PM

Having no internet connection on your Windows 11 computer in Safe Mode with Networking can be frustrating, especially when diagnosing and troubleshooting system issues. In this guide, we will discuss the potential causes of the problem and list effective solutions to ensure you can access the internet in Safe Mode. Why is there no internet in safe mode with networking? The network adapter is incompatible or not loading correctly. Third-party firewalls, security software, or antivirus software may interfere with network connections in safe mode. Network service is not running. Malware Infection What should I do if the Internet cannot be used in Safe Mode on Windows 11? Before performing advanced troubleshooting steps, you should consider performing the following checks: Make sure to use

Golang error: 'invalid use of ... operator' How to solve it? Golang error: 'invalid use of ... operator' How to solve it? Jun 24, 2023 pm 05:54 PM

For Golang developers, "invaliduseof...operator" is a common error. This error usually occurs when using variable-length parameter functions. It will be detected at compile time and indicate which parts have problems. This article will introduce how to solve this error. 1. What is a variable-length parameter function? A variable-length parameter function is also called a variable-parameter function. It is a function type in the Golang language. Using variable-length parameter functions, you can define multiple ones as follows

How to open multiple Toutiao accounts? What is the process for applying for a Toutiao account? How to open multiple Toutiao accounts? What is the process for applying for a Toutiao account? Mar 22, 2024 am 11:00 AM

With the popularity of mobile Internet, Toutiao has become one of the most popular news information platforms in my country. Many users hope to have multiple accounts on the Toutiao platform to meet different needs. So, how to open multiple Toutiao accounts? This article will introduce in detail the method and application process of opening multiple Toutiao accounts. 1. How to open multiple Toutiao accounts? The method of opening multiple Toutiao accounts is as follows: On the Toutiao platform, users can register accounts through different mobile phone numbers. Each mobile phone number can only register one Toutiao account, which means that users can use multiple mobile phone numbers to register multiple accounts. 2. Email registration: Use different email addresses to register a Toutiao account. Similar to mobile phone number registration, each email address can also register a Toutiao account. 3. Log in with third-party account

Analysis of the meaning and usage of += operator in C language Analysis of the meaning and usage of += operator in C language Apr 03, 2024 pm 02:27 PM

The += operator is used to add the value of the left operand to the value of the right operand and assign the result to the left operand. It is suitable for numeric types and the left operand must be writable.

Roblox Not Working: How to Fix It Roblox Not Working: How to Fix It Jul 28, 2023 pm 06:23 PM

Roblox Not Working: Why? With its wide selection of games and active community, the famous online gaming platform Roblox has won millions of fans around the world. However, Roblox may occasionally encounter technical issues, as with any complex digital platform. Below, we’ll look at some possible fixes to fix your Roblox not working error. Let’s cut to the chase and start with the first thing! Check Roblox Server Status Since Roblox is an online game, you may experience difficulty launching it if the service is interrupted. Keep Roblox's current server status and operations functioning properly. If the server is offline for maintenance, wait until the server-side problem is resolved. have

Mind map of Python syntax: in-depth understanding of code structure Mind map of Python syntax: in-depth understanding of code structure Feb 21, 2024 am 09:00 AM

Python is widely used in a wide range of fields with its simple and easy-to-read syntax. It is crucial to master the basic structure of Python syntax, both to improve programming efficiency and to gain a deep understanding of how the code works. To this end, this article provides a comprehensive mind map detailing various aspects of Python syntax. Variables and Data Types Variables are containers used to store data in Python. The mind map shows common Python data types, including integers, floating point numbers, strings, Boolean values, and lists. Each data type has its own characteristics and operation methods. Operators Operators are used to perform various operations on data types. The mind map covers the different operator types in Python, such as arithmetic operators, ratio

Are Douyin sleep anchors profitable? What are the specific procedures for sleep live streaming? Are Douyin sleep anchors profitable? What are the specific procedures for sleep live streaming? Mar 21, 2024 pm 04:41 PM

In today's fast-paced society, sleep quality problems are plaguing more and more people. In order to improve users' sleep quality, a group of special sleep anchors appeared on the Douyin platform. They interact with users through live broadcasts, share sleep tips, and provide relaxing music and sounds to help viewers fall asleep peacefully. So, are these sleep anchors profitable? This article will focus on this issue. 1. Are Douyin sleep anchors profitable? Douyin sleep anchors can indeed earn certain profits. First, they can receive gifts and transfers through the tipping function in the live broadcast room, and these benefits depend on their number of fans and audience satisfaction. Secondly, the Douyin platform will give the anchor a certain share based on the number of views, likes, shares and other data of the live broadcast. Some sleep anchors will also

See all articles