Limit Character / String Display With Fake Ellipsis

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. function stringDisplay($str, $charLimit) {
  2. if(strlen($str) > $charLimit) return substr($str, 0, $charLimit).'...';
  3. return $str;
  4. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.