return substring code example
Example 1: php limit string length
if (strlen($str) > 10)
$str = substr($str, 0, 7) . '...';
Example 2: substring javascript
var str = "Hello world!";
var res = str.substring(1, 4); //ell
if (strlen($str) > 10)
$str = substr($str, 0, 7) . '...';
var str = "Hello world!";
var res = str.substring(1, 4); //ell