Perad Posted March 16, 2007 Share Posted March 16, 2007 I am calling a load of infomration from my database, unfortunately there is not much room on the page to display the whole article, instead i plan to limit the result to set amount of characters and add a link to read the whole thing.. How do i do this? The variable is called $blog_content Link to comment https://forums.phpfreaks.com/topic/42973-setting-a-set-number-of-characters-for-a-variable/ Share on other sites More sharing options...
Orio Posted March 16, 2007 Share Posted March 16, 2007 <?php $length = 10; //Show 10 first chars $blog_content = "abcdefghijklmnopqrstuvwxyz"; echo substr($blog_content, 0, $length)."... Read more!"; /* Output- abcdefghij... Read more! */ ?> Orio. Link to comment https://forums.phpfreaks.com/topic/42973-setting-a-set-number-of-characters-for-a-variable/#findComment-208734 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.