Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $list = $_GET['list'];
- $maxSize = intval($_GET['maxSize']);
- $newLine = preg_split('/\r\n/', $list, -1, PREG_SPLIT_NO_EMPTY);
- echo "<ul>";
- for ($i=0; $i < sizeof($newLine); $i++) {
- $result= trim($newLine[$i]);
- if (strlen($result) > $maxSize) {
- $result = substr($result, 0, $maxSize);
- echo '<li>' . htmlspecialchars($result) . '...' . '</li>';
- } else {
- if ($result != "") {
- $result = substr($result, 0, $maxSize);
- echo '<li>' . htmlspecialchars($result) . '</li>';
- }
- }
- }
- echo "</ul>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement