Home php教程 php手册 php中r rn t的区别示例介绍

php中r rn t的区别示例介绍

Jun 06, 2016 pm 08:25 PM
r t

这篇文章主要介绍了php中\r \r\n \t的区别,需要的朋友可以参考下

\n 软回车:
在Windows 中表示换行且回到下一行的最开始位置。相当于Mac OS 里的 \r 的效果。
在Linux、unix 中只表示换行,但不会回到下一行的开始位置。

\r 软空格:
在Linux、unix 中表示返回到当行的最开始位置。
在Mac OS 中表示换行且返回到下一行的最开始位置,相当于Windows 里的 \n 的效果。

\t 跳格(移至下一列)。

它们在双引号或定界符表示的字符串中有效,在单引号表示的字符串中无效。
\r\n 一般一起用,用来表示键盘上的回车键,也可只用 \n。
\t表示键盘上的“TAB”键。

就像你使用 enter和shift+enter的区别,如果要显示在页面上的效果还要转化为HTML代码或用...

文件中的换行符号:

linux,unix: \r\n
windows: \n
Mac OS : \r

对应:

\n LF或ASCII中的0x0A(10)
\r CR或ASCII中的0x0D(13)
\t 水平制表符-HT或ASCII中的0x09(9)
\\ 反斜杠
\$ 美圆符
\" 双引号
\' 单引号

有关它们的来历并引起分歧垢原由:

“回车”(carriage return)和“换行”(line feed)这两个概念的来历和区别了。
在计算机还没有出现之前,有一种叫做电传打字机(Teletype Model 33)的玩意,每秒钟可以打10个字符。但是它有一个问题,就是打完一行换行的时候,要用去0.2秒,正好可以打两个字符。要是在这0.2秒里面,又有新的字符传过来,那么这个字符将丢失。

于是,研制人员想了个办法解决这个问题,就是在每行后面加两个表示结束的字符。一个叫做“回车”,告诉打字机把打印头定位在左边界;另一个叫做“换行”,告诉打字机把纸向下移一行。

这就是“换行”和“回车”的来历,从它们的英语名字上也可以看出一二。

后来,计算机发明了,这两个概念也就被般到了计算机上。那时,存储器很贵,一些科学家认为在每行结尾加两个字符太浪费了,加一个就可以。于是,就出现了分歧。

Unix系统里,每行结尾只有“”,即“\n”;Windows系统里面,,每行结尾是“”,即“\n\r”;Mac系统里,每行结尾是“”。一个直接后果是,Unix/Mac系统下的文件在Windows里打开的话,所有文字会变成一行;而Windows里的文件在Unix/Mac下打开的话,在每行的结尾可能会多出一个^M符号。

c语言编程时(windows系统)

\r 就是return 回到 本行 行首 这就会把这一行以前的输出 覆盖掉

如:

复制代码 代码如下:


int main() {
cout }


最后只显示 xixi 而 hahaha 背覆盖了

\n 是回车+换行 把光标 先移到 行首 然后换到下一行 也就是 下一行的行首拉

复制代码 代码如下:


int main() {

cout }


则 显示 :

hahaha
xixi
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 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months 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)

Trezor Cold Wallet: Model One and Model T Features and Usage Guide Trezor Cold Wallet: Model One and Model T Features and Usage Guide Jan 19, 2024 pm 04:12 PM

After problems occurred in many centralized exchanges, more and more cryptocurrency investors began to transfer assets to cold wallets to reduce the risks posed by centralized exchanges. This article will introduce Trezor, the world's earliest cold wallet provider. Since the first cold wallet was launched in 2014, it has been sold in many countries around the world. Trezor's products include Model One launched in 2014 and the advanced version Model T launched in 2018. The following will continue to introduce the differences between these two products and other cold wallets. What is Trezor cold wallet? In 2014, Trezor launched the first cold wallet ModelOne. In addition to common BTC, ETH, USDT and other currencies, the wallet also supports more than 1,000 other currencies.

Python or R: Which programming language is better for data science? Python or R: Which programming language is better for data science? Apr 12, 2023 am 08:28 AM

A little background on R R is a programming language and analysis tool developed by Ross Ihaka and Robert Gentleman and first introduced in 1993. At the same time, it is also a free open source software with a rich statistical and graphical technology library. R is one of the most used tools by analysts, statisticians, and researchers for retrieving, cleaning, analyzing, visualizing, and presenting data. Many industries such as IT, banking, healthcare, and finance use R. Purpose Data scientists can use the R programming language to collect data, perform statistical analysis, and produce visualizations. It can be used for graphical representation. R can be used for both machine learning and deep

How does Redstone (RED) benefit BNBHolder this airdrop? How does Redstone (RED) benefit BNBHolder this airdrop? Mar 04, 2025 pm 06:06 PM

Redstone (RED) airdrop activity brings great benefits to BNB holders! Redstone, an innovative multi-chain oracle project that supports more than 70 blockchains and covers more than 1,250 assets, has its token RED airdropped through Binance Launchpool. By participating in the activities, BNB holders can invest idle assets into the RED reward pool for mining, obtain RED tokens, realize asset appreciation, improve asset utilization efficiency, enrich investment portfolios, and reduce risks. However, we need to pay attention to volatility in the cryptocurrency market, invest rationally, and assess risks carefully. Join Redstone (RED) airdrop now and seize wealth opportunities!

What is the difference between PHP functions and R functions? What is the difference between PHP functions and R functions? Apr 25, 2024 pm 03:51 PM

PHP and R functions have the following differences in syntax, data types, data structures and function scope: 1. Syntax: PHP functions follow C-style syntax, while R functions use S-style syntax. 2. Data type: PHP is a weakly typed language, while R is a strongly typed language. 3. Data structure: PHP supports a variety of data structures, while R is dedicated to statistical data and provides optimized data structures. 4. Function scope: PHP function scope is limited to the function body, while R function scope is more complex.

In C++, translate the following into Chinese: Count the number of numbers between L and R that are relatively prime to P In C++, translate the following into Chinese: Count the number of numbers between L and R that are relatively prime to P Aug 26, 2023 pm 09:33 PM

In the world of computer programming, finding the number of numbers in a given range that is coprime to a specific number can be a common task. Relatively prime numbers, also known as relative prime numbers, are numbers that have no common factors other than 1. In this article, we will explore finding the number of numbers that are relatively prime to a specific number P between the given integers L and R by using C++ language. Syntax We will first outline the syntax of the method we will use in the following code examples - intcountCoprimes(intL,intR,intP); Algorithm The algorithm we will use to count the number of coprime numbers is as follows − Initialize the variable count as 0, used to store the count of relatively prime numbers. Iterate over each number num starting from L until R. for each

How to upgrade r720 to win11 How to upgrade r720 to win11 Dec 25, 2023 pm 05:31 PM

The Savior r720 is a notebook model launched by Lenovo’s Savior series in 2017. Although 5 years have passed, it can still run smoothly for almost all games. Therefore, some users also want to use it to update the latest win11 system, but don't know how to upgrade. Let's take a look below. How to upgrade r720 to win11: 1. Unfortunately, r720 uses the seventh generation Intel processor, which does not meet Microsoft's requirements for win11. 2. Therefore, if users want to upgrade to win11, they must skip the system detection and upgrade in the pe system. 3. To enter the pe system, you first need to prepare a system U disk. 4. If we do not have a bootable USB disk, we need to manually create it.

Detailed introduction to R71700 compatibility with Windows 11 Detailed introduction to R71700 compatibility with Windows 11 Jan 13, 2024 pm 05:24 PM

As we all know, the win11 upgrade has very high requirements for the processor, so some AMD Ryzen r71700 processor users don’t know whether their computers can install the win11 system. In fact, we don’t have to worry, it can be installed. Let’s follow the editor’s instructions Let's get up and take a look at the specific situation. Can r71700 be installed with win11? Answer: r71700 processor can be installed with win11 system. Installation method one: 1. First enter "Settings" through the start menu in the lower left corner 2. Then select "Update and Security" 3. Then enter the Windows Insider Program, and after joining, select "dev channel" 4. Then enter "Windows Update ”, where you can download and install win11 by detecting updates.

Development using MySQL and R language: How to implement data analysis functions Development using MySQL and R language: How to implement data analysis functions Jul 30, 2023 am 11:12 AM

Development using MySQL and R language: How to implement data analysis functions R language is a programming language specifically used for data analysis and statistical calculations, while MySQL is a commonly used relational database management system. The combination of the two can achieve powerful data Analysis functions. This article will take you through how to use MySQL and R language for data analysis, and provide corresponding code examples. 1. Database connection First, we need to install and load some necessary packages in R in order to connect to the MySQL database. This can be done with the following code

See all articles