title: Why I am getting : Fatal error: Uncaught Error: Only variables can be passed by reference Message?
body: <p>I have Registration class and here I have defined public function insert and in <code>bindParam</code> function line I'm getting error message which is : </p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Only variables can be passed by reference</p>
  </blockquote>
  
  <pre><code>public function insert ( $table, $coloumns, $values, string $where = null, string $whereValue = null )
      {
          global $db; 
          $tbl_columns = array(); 
          foreach ($coloumns as $key =&gt; $value) {
              $tbl_columns[] = ":{$value}";
          }       
          $tbl_columns = implode(', ', $tbl_columns);     
          $values = implode(',', $values);
  
          $coloumns2 =  implode(',', $coloumns);
  
          $sql = " INSERT INTO $table ( $coloumns2 ) VALUES ( $tbl_columns )";
          if($where &amp;&amp; $whereValue) {
              $sql .= " WHERE $where = '$whereValue' ";
          }
          $stm = $db-&gt;prepare($sql);
          foreach ($coloumns as $key =&gt; $value) {
              $stm-&gt;bindParam(":{$value}", $values[$key]);
          }           
  
          return $sql;
      }
  </code></pre>