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

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>

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).


you are probably using something like:

if(empty(urFunc($foo)){
    ....
}

which won't work.

what ever it is (look for the lien number in the error to locate it) change it to:

$foo = urFunc($bar);
if(empty($foo)){
    ....
}

that should fix it.

链接地址: http://www.djcxy.com/p/69244.html

上一篇: 致命错误:不能在写入上下文中使用函数返回值

下一篇: 致命错误:不能在写入上下文中使用函数返回值