怎么样\r和\n不同?我认为这与Unix与Windows与Mac有关,但我不确定它们是如何不同的,以及在正则表达式中搜索/匹配的方式.
在下面的代码中,我不知道这些字符在功能上是如何彼此不同的:\ r\t \n.有没有人对这些有解释或描述?
以下是一些示例代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Sorting words in a block of text by length</title>
<link rel="stylesheet" type="text/css" href="common.css" />
</head>
<body>
<h1>Sorting words in a block of text by length</h1>
<?php
$myText = <<<END_TEXT
But think not that this famous town has
only harpooneers, cannibals, and
bumpkins to show her visitors. Not at
all. Still New Bedford is a queer place.
Had it not been for us whalemen, …Run Code Online (Sandbox Code Playgroud)