title: How to use if statements inside foreach loops?
body: <p>I'm trying to create an if statement inside a foreach loop that obtains data from a column named ['online'], the value is either 0 or 1. I'm trying to convert the value to a string like so:</p>
  
  <pre><code>  $result = mysqli_stmt_get_result($stmt);
    $datas = array();
  
    while($row = mysqli_fetch_assoc($result)){
      $datas[] = $row;
    }
  
    foreach($datas as $data){
      $status = $data['online'];
      if($status = 1){
        $status = "Online";
      }else{
        $status = "Offline";
      }
      echo '&lt;td&gt;'.$status.'&lt;/td&gt;';
    }
  </code></pre>
  
  <p>If the value is 1 it should be converted to "Online". If it's not 1 then it should be "Offline", currently I get all the results showing as "Online". Not sure why, help would be appreciated! :)</p>