0

How can I fix this?

function _data($values){
foreach ($values as $key => $value){
    $this->_data($key)  = $value;
}

returns error message Fatal error:

Can't use method return value in write context

Pradeep
  • 9,667
  • 13
  • 27
  • 34
  • 2
    `$this->_data()` is a method. What do you expect to happen here? Also, since `$this->_data()` expects an array, calling it with `$key` won't work either. Please update your question to include what it is you're trying to accomplish. – M. Eriksson Jun 03 '18 at 10:34
  • Perhaps `_data` is also a property and the intention is setting the array element using [] instead of () - `$this->_data[$key] = $value;` – Nigel Ren Jun 03 '18 at 10:48

0 Answers0