[thelist] PHP explode, and name value pairs
Donald Noble
donaldrnoble at yahoo.com
Thu Apr 18 14:20:01 CDT 2002
Hi evolters, hope you can help me with this...
Using PHP, what is the 'best' way to handle a series of name value pairs
that are to be stored as a single string but need to be manipulated as
separate items. To make things more complicated there will be a variable
number of name value pairs.
I have used the explode function to create an array of items from a
list, but I am unsure how best to extend this to name value pairs.
The 2 ideas I had had were:
Store the data in the form name1:value1/name2:value2/name3:value3 then
split this up into an array so that array['name1']==value1 etc.
Alternatively store the data as name1:name2:name3/value1:value2:value3
and then split the data into 2, then into 2 arrays so that
names[0]==name1 and values[0]==value1
Which of these would be easier/faster/better - or is there another way
to do this altogether
Cheers for your help, Donald
--
http://www.AccessibleComputers.co.uk
Hardware, Software & Custom built PC Systems
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
More information about the thelist
mailing list