Wednesday, 1 February 2017

arrays - PHP Error : Can't use function return value in write context




Can't seem to see what's the problem in this one,
Should be simple but i seem to be witless.




    if(empty(search($class,'id',$p_cid))){
unset($categories[$elementKey]);
}


search function returns an array.


Answer



It should be this way:




$arr = search($class, 'id', $p_cid);
if (empty($arr)) {
unset($categories[$elementKey]);
}

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...