From e2804c45a5290e28edba6aa49ad743736b72515a Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 29 Apr 2012 15:12:06 +0200 Subject: [PATCH] Add split_lines() to CPHP --- frontend/includes/include.parsing.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/includes/include.parsing.php b/frontend/includes/include.parsing.php index 6e0a0e5..319ba59 100644 --- a/frontend/includes/include.parsing.php +++ b/frontend/includes/include.parsing.php @@ -18,6 +18,18 @@ function split_whitespace($input) return preg_split("/\s+/", $input); } +function split_lines($input) +{ + $lines = explode("/n", $input); + + foreach($lines as &$line) + { + $line = trim($line); + } + + return $lines; +} + function shrink_command($command) { $command = preg_replace("/(\t+|\n)/", " ", $command);