jeudi 26 mars 2015

PHP failing If statement despite individual components returning true

.Hello, I have an If statement that was failing [ if($file1 && $file2 && $file3) ] so I decided to test the individual parts of the If statement to see which part was causing the failure but they all passed. Any ideas what this could be?


Example of the code:


These are the onese I was using to test:



if($file1){
echo "File1 Success";
} else {
echo "File1 Fail";
}

if($file2){
echo "File2 Success";
} else {
echo "File2 Fail";
}

if($file3){
echo "File3 Success";
} else {
echo "File3 Fail";
}


This is the actual one that I am trying to figure out why it's failing:



if($file1 && $file2 && $file3){
...do something
} else {
echo "If statement failed";
}


EDIT: $file1 is a integer used in a database $file2 is a varchar for who entered it $file3 is the actual file name


Later on the file name is used for making a path but it fails before it even gets there.


Aucun commentaire:

Enregistrer un commentaire