PHP Regular replacement problem, how to replace this form?
- three-day two-night thriller Park
-
Welcome to the thriller Park.
This is not only a game, but also a challenge and trial.
Fear is human instinct, it makes people weak, panic, and thus make mistakes.
Money can arm the players, but wisdom and courage cannot be bought.
...
- three-day two-night thriller Park
-
Welcome to the thriller Park. This is not only a game, but also a challenge and trial. Fear is human instinct, it makes people weak, panic, and thus make mistakes. Money can arm the players, but wisdom and courage cannot be bought. ...
Filter out the carriage returns and spaces between the text instead of the space between the HTML and the carriage return.
------Solution--------------------
$str =<<
<>
- Three
Days
Two-night Thrill Park
-
Welcome to
To the thriller Park.
This is not only a game, but also a challenge and trial.
Fear is the human instinct, it makes a man weak,
Panic, and thus make mistakes. XX zzzz
Xxx
Money can play the player
installed, but wisdom and courage can not be bought.
...
EOD;
function Shanchu ($STR) {
$str = preg_replace ('/\s/', ' ', $str);
$str = preg_replace ('/\n/', ' ', $str);
Return ' > ' $str. ' < ';
}
echo ""; <br/><br/>print_r (Preg_replace ("/\> (. +?) \</esi "," Shanchu (' \\1 ') ", $str)); <br/>echo"";
echo "";
Exit