title: "Fatal error: Can't use function return value in write context" in PHP
body: <p>Why does this happen:</p>
  
  <blockquote>
    <p>Fatal error: Can't use function return value in write context in C:\xampp\htdocs\phps\site.php on line 14</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" dir="ltr"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="site.php" method="post"&gt;
  enter your name :&lt;input type="text" name="fn"&gt;
  enter your age :&lt;input type="number" name="age"&gt;
  &lt;input type="submit" value="click me" name="submit"&gt;
  &lt;/form&gt;
  &lt;?php
  if (isset($_POST["submit"]) &amp;&amp; strlen($_POST["fn"]) = 0 &amp;&amp; 
  strlen($_POST["age"]) = 0) {
  echo "enter your name and your age";
  }
  elseif (isset($_POST["submit"]) &amp;&amp; strlen($_POST["fn"]) &gt; 0 &amp;&amp; 
  strlen($_POST["age"]) = 0) {
  echo "enter your age";
  }
  elseif (isset($_POST["submit"]) &amp;&amp; strlen($_POST["fn"]) = 0 &amp;&amp; 
  strlen($_POST["age"]) &gt; 0) {
  echo "enter your name";
  }
  else {
  $name = $_POST["fn"];
  $age = $_POST["age"];
  echo "my name is $name&lt;br&gt;";
  echo "i am $age years old";
  }
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>to show text boxes</p>