title: Assign and use variable inside of PHP if statement
body: <p>I am wondering whether it is possible to use a variable inside of the same <code>if</code> statement that it is assigned in using PHP.</p>
  
  <p>For example:</p>
  
  <pre><code>if ($start = strtotime($_POST['date']) &amp;&amp; $start &lt;= time()) {
      $error = 'You must choose a date in the future.';
  }
  </code></pre>
  
  <p>That code does not appear to be working for me, but I don't see why it shouldn't since I know the variable can be assigned like that, and it would make sense for me for the following variable to then be able to access it.</p>