Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting a string into an array of words 1

Status
Not open for further replies.

McBugzz

Programmer
Sep 17, 2002
90
JP
Let's say I have a string. "Hello world" for example.

How do I transform it into an array like this:

[0]: "Hello"
[1]: "world"

I need this to have an array of keywords when parsing a search request.

Thanx
 
$string="Hello World"
$array=explode(' ',$string);

echo "$array[1], $array[0]";

should return:
World Hello ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top