homepage Welcome to WebmasterWorld Guest from 54.167.138.53
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
selecting
dav_999

5+ Year Member



 
Msg#: 3859023 posted 9:09 am on Feb 27, 2009 (gmt 0)

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

10+ Year Member



 
Msg#: 3859023 posted 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

5+ Year Member



 
Msg#: 3859023 posted 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

5+ Year Member



 
Msg#: 3859023 posted 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.....

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved