bitejones Posted December 23, 2008 Share Posted December 23, 2008 Hi, I have a problem, i am really new at php, and i am trying to build a website, but have an article that im outputting to my main page, but i only want to display like the fist 50 words of the article. i have no clue how to do this so i would really appreciate it if someone help me...only the first 50 words or so, the user will have the option by clicking on more to continue reading...thanks Quote Link to comment https://forums.phpfreaks.com/topic/138111-output-first-few-lines-only/ Share on other sites More sharing options...
premiso Posted December 23, 2008 Share Posted December 23, 2008 substr You would have to do an average of words. Or use split them at the "space" and count them that way. Quote Link to comment https://forums.phpfreaks.com/topic/138111-output-first-few-lines-only/#findComment-721969 Share on other sites More sharing options...
trq Posted December 23, 2008 Share Posted December 23, 2008 See this example in the substr manual page. Quote Link to comment https://forums.phpfreaks.com/topic/138111-output-first-few-lines-only/#findComment-721972 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.