php trim string length – Truncate a string to first n characters of a string and add three dots if any characters are removed
$user_line = substr($user_line,0,10).'...';
php trim string length
Contents
using substr() php, php trim string to length and print only some characters of a string in php.
substr(string,start,length)
php trim string to length
substr() php
<?php echo substr('tamilrockers', 1);     echo substr('tamilrockers', 1, 3);  echo substr('tamilrockers', 0, 4);  echo substr('tamilrockers', 0, 8);  echo substr('tamilrockers', -1, 1); $user_line = 'tamilrockers'; echo $user_line[0];                echo $user_line[3];               echo $user_line[strlen($user_line)-1]; ?> //substr() function returns certain bits of a string
php trim string to length
Example
<?php echo substr('tamilrockers', 1); echo substr('tamilrockers', 1, 3); echo substr('tamilrockers', 0, 4); echo substr('tamilrockers', 0, 8); echo substr('tamilrockers', -1, 1); $user_line = 'tamilrockers';
php get first 5 characters of string
$result = substr("Welcome To Pakainfo.com free Download", 0, 5);
php get first character of string
$firstuser_lineCharacter = substr("Welcome", 0, 1);
take last four digits php
$newuser_line = substr($dynamicuser_line, -7);
I hope you get an idea about php trim string length.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.