i am trying to use php to open a text file and display the contents which are delimited by the "|" pipe. imagine this as a table made up of 4 columns.
any ideas on how i can get php to parse this?
i've tried a few different methods, using split, split_preg, fopen and explode, but i can't seem to get it.
here is what i have now:
<?php
$file = file("filename.txt");
foreach($file as $lot){
$output = split('|', $lot);
print "$output[3], $output[2], output[1], $output[0]\n";
}
?>
this results in the following error:
bad regular expression for split()
any help is appreciated. it is very likely that i could be going about this the wrong way.
thanks.
p