Forum Moderators: coopster
//if comment file exists, read and print comments
if (file_exists($comment_file))
{
$file_array = file($comment_file);
foreach($file_array as $line)
{
$line_array = explode("¦", $line);
echo $line_array[0].'<br/ >';
echo $line_array[1].'<br/ >';
echo $line_array[2].'<br/ >';
}
}
any ideas?
[webmasterworld.com...]
if you have a variable like
$var = array('a', 'b');
$var[0] is defined and is 'a'
$var[3] is undefined and throws a warning.
Generally, all variables should be defined before you use them for the most predictable results. You can turn error reporting down and depend on the default behavior of PHP which is relatively safe, but definitely not the preferred option.
I recently checked out an open source calendar program. It had undefined variables, offsets and index errors all over because the author had developed with error reporting at the default level. When I edited the code, I found that he had several bugs that did not show up because he was depending on the default behavior. Merely correcting for this got rid of at least six bona fide bugs in his script.
Tom