Update base.php

This commit is contained in:
Namhyeon Go 2018-01-17 22:49:04 +09:00 committed by GitHub
parent 3897bf1484
commit 1688592b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,7 +54,7 @@ if(!function_exists("cut_str")) {
}
}
if(!function_exists('read_file_by_line')) {
if(!function_exists("read_file_by_line")) {
function read_file_by_line($filename) {
$lines = array();
$handle = fopen($filename, "r");
@ -69,3 +69,15 @@ if(!function_exists('read_file_by_line')) {
return $lines;
}
}
if(!function_exists("nl2p")) {
function nl2p($string) {
$paragraphs = '';
foreach (explode("\n", $string) as $line) {
if (trim($line)) {
$paragraphs .= '<p>' . $line . '</p>';
}
}
return $paragraphs;
}
}