title: PHP Fatal Error: "Can't use method return value in write context in.... "
body: <p>Trying to use a class that expects something like:</p>
  
  <pre><code>$client-&gt;firstname = 'bob';
  
  $client-&gt;lastname = 'jones';
  </code></pre>
  
  <p>So I want to pass this data to the script in an array... where the keys and values are set elsewhere.  I want to step through the array passing the key and value to the class.  Trying to use this:</p>
  
  <pre><code>while($Val = current($CreateClientData)){
  
      $client-&gt;key($CreateClientData) = $Val;
      next($CreateClientData);
  }
  </code></pre>
  
  <p>getting this:</p>
  
  <blockquote>
    <p>Fatal error: Can't use method return value in write context in
    blahblahpath on line 40.</p>
    
    <p>Line 40 being: $client->key($CreateClientData) = $Val;</p>
  </blockquote>
  
  <p>How can I do this?</p>