Well that was easy enough to fix. Out of frustration I changed a couple of things.
This stuff MUST have a space:
$linearray = explode(' ',$line);
and
echo "<PRE>";
print_r($linedata);
should have been:
echo "<PRE>";
print_r($line);
This is the final code I came up with to get the results to display:
<?php
$data = file('mains.txt');
$parts = preg_split("!\\s!",$line, -1, PREG_SPLIT_NO_EMPTY);
$parts = preg_split("!\n!",$line, -1, PREG_SPLIT_NO_EMPTY);
$data = preg_replace('/ +/',' ',$data);
foreach ($data as $line)
{
$linearray = explode(' ',$line);
echo "<PRE>";
print_r($line);
}
?>
You can see the example here.
My question is now. If I were to test $linearray[0] == "pos"
then how would I drop that line and move on to the next one without printing it?