Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

the page code is all html and it wont load bec. of this error:

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

code:

<div>
    <div class="">
        <input type="text" id="select_shelves" name="select_shelves" class="shelves_select_and_buttons" />
        <div id="shelves_menu" >
            <ul>
                <li id="li_" onclick="printValue();">option5 <= line 142 </li>
            </ul>
        </div>
    </div>
    <div class="button">
        <input type="button" onclick="dropShelves();" id="Shelves_select_button" name="Shelves_select_button" value="" class="grey_button"/>
    </div>
</div>
like image 593
bm2001 Avatar asked Apr 18 '11 13:04

bm2001


1 Answers

If there is some PHP behind, the problem could be calling a function empty($var) in this way:

if(empty($var = getMyVar())) { ... }

Instead of this You should call it this way:

$var = getMyVar();
if(empty($var)) { ... }

Or better (as deceze has pointed out)

if(!getMyVar()) { ... }

Problem causes also other similar functions (isset, is_a, is_null, etc).

like image 80
shadyyx Avatar answered Sep 30 '22 17:09

shadyyx