title: Verifying a string length in an if statement. PHP
body: <p>The problem in my assignment is to verify the length of a string(a phone number in this case) given in a form that is POSTed, and then create a substring consisting of a portion of the data given. <br><br> Specifically if the number is 6235551234, the selection should be 555.</p>
  
  <pre><code>$phone = $_POST['phone'];
  
  if (strlen($phone) = 10) {
          $phone_prefix = substr($phone, 3, 3);
      } else {
          echo 'Enter Proper phone number' ;
      }
  </code></pre>
  
  <p>However for the code I receive this error.. "Fatal error: Can't use function return value in write context<br> Any ideas?"</p>