Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Here is my code:Code: Select all
$handle = fopen("players.txt", "r");
while (!feof($handle)) {
$file .= fread($handle, 1024);
}
fclose($handle);
$parts = explode("[player]", $file);
$players = array();
$index = 0;
foreach($parts as $part)
{
while (preg_match("/[(.*)](.*)[\/.*]/", $part, $match))
{
echo "test";
$players[$index][$match[1]] = $match[2];
$index++;
}
}Code: Select all
[player]
[name]john1[/name]
[kills]124[/kills]
[deaths]345[/deaths]
[/player]
[player]
[name]bob1[/name]
[kills]342[/kills]
[deaths]54[/deaths]
[/player]P.S If you havn't noticed I'm trying to parse the user stats into an array.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]