01c02-1.php

来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 15 行

PHP
15
字号
<?php$str = " This line  contains\tliberal \r\n use of   whitespace.\n\n";// First remove the leading/trailing whitespace$str = trim($str);// Now remove any doubled-up whitespace$str = preg_replace('/\s(?=\s)/', '', $str);// Finally, replace any non-space whitespace, with a space$str = preg_replace('/[\n\r\t]/', ' ', $str);// Echo out: 'This line contains liberal use of whitespace.'echo "<pre>{$str}</pre>";?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?