Welcome to WebmasterWorld Guest from 54.163.35.238

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

selecting

     

dav_999

9:09 am on Feb 27, 2009 (gmt 0)

5+ Year Member



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)

10+ Year Member



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)

5+ Year Member



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)

5+ Year Member



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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month