Search code examples
phpprestashop-1.6

Prestashop module weird issue


I am developing a custom module in prestashop. In that I have taken value inside a function like this

$fname = !empty(Tools::getValue('fname')) ? Tools::getValue('fname') : '';

but its showing error like this

Fatal error: Can't use function return value in write context

So can someone tell me why the error is here? How to solve this issue?


Solution

  • I got the answer. It should be like this

    Tools::getValue('fname') ? Tools::getValue('fname') : ' ';