So, im trying to make a simple little tagboard. The idea is to open a text file using file(...), then go through each line of that array using foreach, then keep count of what string token im at, and only print the first two (name, message). However, the tokenizer doesnt seem to be advancing: it prints the first token twice.
Here she be:
<?php
$array = file("stuff.dat");
$strctpos = 0;
foreach($array as $line){
for($strctpos="0";$strctpos<="3";$strctpos++){
$tok=strtok($line, "%%||");
if ($strctpos=="0"){print"<b>$tok</b>:";}
else if ($strctpos=="1"){print" $tok<br>";}
else {};
}
}
Team planet go!