This article mainly introduced the PHP to each paragraph adds the space the method, involves the Php_eol variable and the array and the string operation skill, has certain reference value, the need friend may refer to under
The example in this article describes how PHP adds spaces to each paragraph. Share to everyone for your reference. The implementation methods are as follows:
?
1 2 3 4, 5 6 7 8 9 10 11 12 13 14 15 |
<?php//prepends whitespace to the A string function White_space ($string, $whitespace) {//create an array f Rom the string, each key has one line $string = Explode (Php_eol, $string); Loop through the array and prepend the whitespace foreach ($string as $line => $text) {$string [$line] = $whitespa Ce. $text; //return the string return (implode (Php_eol, $string)); }?> |
I hope this article will help you with your PHP program design.