ok its a very simple thing i want to do i have a text example like $text = 'its a example, the real text will be any thing';
now i want to do is select some words from 'text' (both before and after) example the real text will be
any idea how to do this ?
zollerwagner
11:35 am on Feb 27, 2009 (gmt 0)
You might be looking for the substr() function. You'll want to read the string functions on php dot net. Look for the "documentation" link at the top of the page.
dav_999
1:08 pm on Feb 27, 2009 (gmt 0)
i know about substr() its selecting the words but with the number od characters not with the text and i want with text...
tbarbedo
4:39 pm on Feb 27, 2009 (gmt 0)
you can split the content of the phrase into an array with each key representing a word in the phrase using the split function..
$text = 'its a example, the real text will be any thing'; $wordArray = split(" ", $text);
print_r($wordArray);
// wordArray[0] = its wordArray[1] = a wordArray[2] = example ......etc.....