& Amp; lt ;? Different phpphp systems have different line breaks. different systems have different line breaks. in linux and unix, nMAC uses rwindows. in order to reflect the differences with linux, rwindows is rn. so the implementation method is different on different platforms. using programs you write to run on different platforms has a lot of trouble in php... // Line feed for different php systems
// The implementation of line feed varies with systems.
// In linux and unix/n
// For MAC/r
// Window is/r/n to reflect differences from linux
// The Implementation methods on different platforms are different.
// Using the program you wrote to run on different platforms has a lot of trouble
// Php has three solutions
// 1. use str_replace to replace the line feed.
$ Str = str_replace (array ("/r/n", "/r", "/n"), "", $ str );
// 2. use regular expression replacement
$ Str = preg_replace ('// s */', '', $ str );
// 3. use the variables defined in php (recommended)
PHP_EOL
Follow the statement to wrap the line;
Here I have to review the defined variables in php.
PHP_EOL is one of them, representing the php line break. this variable will change according to the platform. in windows, it will be/r/n, and in linux it will be/n, under mac is/r
$ Str = str_replace (PHP_EOL, '', $ str );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service