|
Dragon Muir
Registered User
Join date: 25 Jun 2005
Posts: 60
|
03-26-2008 03:34
What is the php Equivalent of LlList2CSV LSL? If I wanted to access a single group within a string that is separated by "," what function would you use to do that in php? I was looking at http://www.w3schools.com/php/php_ref_string.asp for an hour and decided to just ask on the forums since everyone is always so helpful on the forums. : ) Example String: Dragon Muir,cat,run,10,bunny I want to get the group “Dragon Muir”. http://www.w3schools.com/php/func_string_substr.asp would work for a set amount of characters, but since people’s names change php needs to be aware of groups in the string separated.
|
|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
03-26-2008 04:37
Try this: (PHP-Code)
$string = "Dragon Muir,cat,run,10,bunny";
$array = explode(",", $string);
$dragon_muir = $array[0]; $cat = $array[1]; ...
«explode» splits up a string into an array -> explode(separator, string). HTH 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-26-2008 07:45
It may not be QUITE that simple if you have vectors or rotations in your list. llCSV2List() automatically detects those and treats them as a single list element rather than splitting them on the internal commas. You might want to use some regular expressions to do the equivalent. If you aren't going to have vectors, rotations, or any other kind of element with internal commas the above solution should work though.
|