sql substr code example
Example 1: php limit string length
if (strlen($str) > 10)
$str = substr($str, 0, 7) . '...';
Example 2: take 10 character from string using php
$return_string = substr("Hi i am returning first 10 characters.", 0, 10);
Output:
"Hi i am re"
Example 3: substr() javascript
const str = 'substr';
console.log(str.substr(1, 2));
console.log(str.substr(1));
console.log(str.substr(-3, 2));
console.log(str.substr(-3));
Example 4: javascript substring
myString.substring( start, end )
Example 5: substr
str.substr(start[, length])