Can't use method return value in write context

后端 未结 8 1217
野趣味
野趣味 2020-11-22 01:52

I would think the following piece of code should work, but it doesn\'t (Edited: Now works in PHP 5.5+):

if (!empty($r->getError()))
         


        
8条回答
  •  既然无缘
    2020-11-22 02:56

    As pointed out by others, it's a (weird) limitation of empty().

    For most purproses, doing this is equal as calling empty, but this works:

    if ($r->getError() != '')
    

提交回复
热议问题