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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with array creation

Status
Not open for further replies.

krappleby025

Programmer
Sep 6, 2001
347
NL
hi guys, i wonder if someone can help me..

i have a database text field, with a list of details in it like this

Search, 2, Appraise, 2

This list could be any length. what i need to do. is take this field, and split it into an array.. (simple enough i here you say)

i have tried to set it up as an array. but all i get is

array[0] = "search, 2, appraise, 2"

when what i need to get is

array[0] = "search"
array[1] = "2"
array[2] = "appraise"
array[3] = "2"

i have tried alsorts, any help would be appreciated.. or any documents that i can read to solve this small minute problem

cheers
 
Use explode to split your string:


$my_string = 'Search,2,Appraise,2';

$my_array = explode(',',$my_string);


result = $my_array[0] = 'search'
$my_array[1] = '2';

etc....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top