Welcome to the Browser-Base Game Zone forums!
// this function is within a classfunction display() { $arrayBuffer = file("file.txt"); while($i--) { //breaks string into sub-arrays $temp = trim($arrayBuffer[$i]); $arraySub = explode("",$temp); $date = $arraySub[0]; $time = $arraySub[1]; $this->user = $arraySub[2]; $this->text = $arraySub[3]; //this is my problem echo "$this->text"; } }
Try adding this line after $arrayBuffer = file("file.txt"):$arrayBuffer = array_reverse($arrayBuffer);I think the problem might be with how you are writing to the text file. If you don't want it to be reversed in the text file as well, you should write to the file by using something like this, instead of appending to the file:$previousText = file("file.txt");$newFile = array_push($previousText, $newline, $newline2, [$newline3...]);//Then here you over-write the file
Oh, ok...btw, for 2), the $newline is the new text that the user submits to the form when posting a new message, it's not part of the code you posted.
You mean a forum just for PHP, or a forum script in PHP?http://www.phpfreaks.com/forums/PHP Freaks seems quite popular, but I don't really go on that forum myself. They used to have a PHP game section, but it looks like they took it off