php trim string length – How to Extract a Substring from a String?

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

using substr() php, php trim string to length and print only some characters of a string in php.


php trim string to length

substr() 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


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 free Download", 0, 5);

Php String Length

Also Read This ūüĎČ   Hide Uncategorized category from WooCommerce

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 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.