[quote author=ted_chou12 link=topic=123506.msg510547#msg510547 date=1169479801] dont you know that php code starts with 0? and from the code above you can clearly see that 8 is in line 5, or is it the problem with your eyesight? [/quote] ORLY? PHP STARTZ AT ZEROES? OMG! Yes, ID 8 is line 5. But as you yourself said, "therefore, the code will return 4 for line 5." Where the hell are you getting a four? Maybe if you would explain things in a way that made sense, you'd get more help. Did you TRY the flipping code I posted? [code] <?php $array = file("posts.txt"); foreach ($array as $line) { $data = explode("#", $line); $array1[$data[0]] = $data[1]; } foreach ($array1 as $line2) { echo $line2;echo "<br>"; } print_r($array1); ?> [/code]