Home Backend Development PHP Tutorial Bad Wolf's PHP Learning Tutorial Day 3 Page 1/2_PHP Tutorial

Bad Wolf's PHP Learning Tutorial Day 3 Page 1/2_PHP Tutorial

Jul 21, 2016 pm 03:51 PM
php superior code copy Study tutorial number of Add

Today I’ve taken it to the next level... First write one: (adding numbers)

Copy the code The code is as follows:

$a = "10"; //"Connect" the right side to the left side
$a += "2"; //"Add" the right side to the left side
echo $a."
n"; //The result here is 12, which probably means that $a is equal to 10, and then add 2 to the left (which is $a), so it is 12.
?>

I think PHP writing pays great attention to the concept of rows. No matter what $a represents, it probably means right to left. "Connect to" or "Add to" or "Reduction to" etc.,! is not just the addition of numbers. There are other ways.
Write another: (right connection to left content)

Copy code The code is as follows:

$b = "Bad Wolf";
$b .= "Good guy!";
$b .= "Good guy!";
echo $b."Haha!n"; //Display the final content!
?>


Why are the results displayed like this? If you listen carefully every time, you will say in the previous paragraph: The running method of the program is from top to bottom, from right to left.


Write another one: (for division)


Copy code The code is as follows:

$a = "65896255618562314793123219"; //Complex calculation here, it turns out that php handles it here easily!
$a /= "465342233234234"; //Multiply these two numbers!
echo $a."←This is the result! 65896255618562314793123219 Except for 465342233234234, wow ordinary people are not as fast as me! Haha@! N "
? & Gt;


Get results 141608156132, the speed is really fast, haha ​​.... ..

Continue to the next big step:
1. Bit operation (this is rarely used)
& stands for and (and)
| stands for or (or)
^ represents mutual exclusion (Xor)
<< Want to shift left
>> Shift right
~ Take the auxiliary number of 1
2. Logical operations (conditions, etc.)
< means less than
> means greater than
<= less than or equal to
>= greater than or equal to
== equal to (general checks such as the user's login is not equal to the condition)
!= is not equal to
&& and and (and)
|| or or (or)
xor mutually exclusive (Xor)
! Not (Not)
Other symbols
3. Other operations
$ variables (used many times)
& indicators of variables (added before variables)
@ do not display error messages (added before functions)
Examples

Copy code The code is as follows:

@include("dbx.txt"); / /If dbx.txt does not exist, an error will be reported, but it will not be displayed after adding @!
echo "
n";
?>


-> The method or attribute of the object
=> The element value of the array
?: Three far operators


Just remember the above, (But it’s not that easy to remember, haha!)
The higher-level ones are introduced below, which are also the more commonly used and key ones when writing programs!

1. Single-line if (judgment)
if. ..else...
If...what, what...what will be the result...responsible...how...
If...you are fat...you are a piglet... Otherwise... you are a skinny monkey.
if(conditon) { statment1} true
else {statment2} false false
Example:

$a = 4.998;
if($a > 5) //No semicolon is needed here, pay attention!
{
echo "Yes! a > 5n";
}
else       // No semicolon is needed here, pay attention!
                                                                                                                                                   



http://www.bkjia.com/PHPjc/319111.html
www.bkjia.com

truehttp: //www.bkjia.com/PHPjc/319111.htmlTechArticleToday we have reached a new level...Write first: (adding numbers) Copy code code As follows: ?php $a="10";//"Connect" the right side to the left side $a+="2";//"Add" the right side to the left side echo$a."brn";//The result here is. ..
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

CakePHP Logging CakePHP Logging Sep 10, 2024 pm 05:26 PM

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

See all articles