I am a bit new here, but I’ve been referred to this forum in hopes that you guys will help me. Please don’t disregard this topic because it’s so long, I really need your help.
I am currently trying to make a forum that looks sort of (or exactly like) that found on [URL=http://www.ticalc.org]ticalc.org
I know this is confusing, but it’s difficult to put into words. You should look at ticalc.org. Basically what I have done is made an array, for example $idsarray of x elements, where x is the number of total replies (ID of 1 counts as one element, ID of 1.4.29 counts as one element), and I want to display them in order. Because someone will reply to a previous reply even after the next reply of a higher priority has been created, I need to order the array based on the following example. I was wondering if anyone could help me with the script (or if anyone knows of a forum that is in the form of [URL=http://www.ticalc.org]ticalc.org
Example:
I have the following elements to order:
1
1.1.1.1
1.1
2
1.2
1.2.1
1.1.3
1.1.1
1.1.2
I need them ordered as:
1
1.1
1.1.1
1.1.1.1
1.1.2
1.1.3
1.2
1.2.1
2
To start off, I have created a script that will find how many periods are in an element (or rather string, which is the type of element in the arrays):
CODE:
function num_times_str_appears($needle, $haystack)
{
$number = 0;
while (strstr($haystack, $needle))
{
// need to get rid of the “.”
// in the beginning of the new $haystack
$temp = strstr($haystack, $needle);
$haystack = ltrim($temp, $needle);
$number++;
}
return $number;
}