Hey Guys,
I've just started up a little project after years of inactivity in the coding world, but hit a bit of a snag. Simplified and to just deal with the root of my problem let's consider the following:
I have three files, index.php, one_list.txt and two_list.txt.
The contents of these files is as follows:
one_list.txt:
code:
monkey
rhino
ironing_board
two_list.txt:
code:
penguin
baguette
pillow
index.php:
code:
<?php
$one = "monkey";
$two = "baguette";
$one_array = file("one_list.txt");
$two_array = file("two_list.txt");
if (in_array("$one",$one_array)){
echo"one present!<br />";
if(in_array("$two",$two_array)){
echo"two present!";
}
else{
echo"two missing!";
}
}
else{
echo"one missing!";
}
?>
Now, basically, when run the index page should set the two variables $one and $two, then set the arrays $one_array and $two_array using the two text files, then check $one_array for $one, and if successful check $two_array for $two, but this isn't working. When I run index.php $one is not found within the array, even though it clearly is in the text file... Can anyone see why? Thanks =)