Mr Chris Posted October 30, 2006 Share Posted October 30, 2006 Hi Guys,In PHP I was wondering:1) If there is a function which lets me output a set amount of words from a text field in a MYSQL database (and if so can someone can provide a link ;D )2) If I have the text saved in the DB as <b>This is the first paragraph<break></b> Is there any way I can get php to say output all the words until you see the first <break> then stop outputting?Thanks Quote Link to comment Share on other sites More sharing options...
alpine Posted October 30, 2006 Share Posted October 30, 2006 Two examples:[code]<?php$string = "abah ashb ashb asadyuci <break>ajkshdkj asduiqw hqwjd </break>sjakj asjkuq";$parts = explode("<break>",$string);echo $parts[0]; // output: abah ashb ashb asadyuciecho join(" ", array_slice(explode(" ", $string), 0, 2)); // output: abah ashb?>[/code] Quote Link to comment 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.