var_dump($managerId);echo"<br>"; while($row = $result->fetch()){ var_dump(intval($row['manager_id'])); if(intval($row['manager_id'])===$managerId){break;} else{$managerId=false;} } 

Conclusion:

The first var_dump() : int (6)

In the loop:

 int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(33) int(125) int(128) 

I see a coincidence. Why doesn't the if condition work?

    1 answer 1

    It's all about else it doesn't fall in if because you set $managerId to false

     var_dump($managerId);echo"<br>"; while($row = $result->fetch()){ var_dump(intval($row['manager_id'])); if(intval($row['manager_id'])===$managerId){break;} else{$managerId=false;} } 
    • Thank. Not until the vardampils ( - doox911
    • four
      How does the code in the answer differ from the code in the question? - Enikeyschik
    • This question can not be given a specific answer - ishidex2