Advertisement
Guest User

Problem1-TextAbbreviator

a guest
Aug 31st, 2014
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. echo "<ul>";
  4. foreach(explode("\n", $_GET['list']) as $line) {
  5.     $line = trim($line); //remove trailing tabs and spaces
  6.     if (strlen($line) > 0) { // remove empty lines
  7.         if (strlen($line) > $_GET['maxSize']) {
  8.             echo "<li>".htmlspecialchars(substr($line,0,$_GET['maxSize']))."...</li>";
  9.         }
  10.         else {
  11.             echo "<li>".htmlspecialchars($line)."</li>";
  12.  
  13.         }
  14. //        var_dump($line);
  15.     }
  16.  
  17. }
  18. echo "</ul>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement