I have a small php snippet that shows me the number of requests received, this is the code written:
$user_id = get_current_user_id();
$new_reqs = UM()->Friends_API()->api()->count_friend_requests_received( $user_id );
echo $new_reqs;
The snippet works perfectly and shows me the number of requests received. The problem is that if I have not received requests it shows nothing. How can I show 0 if I have not received requests? I've tried adding this code
if (empty($new_reqs)) { echo "0"; }
but it doesn't work.
Thanks.
var_dump($new_reqs)
to see what is actually in that variable. – RiggsFolly May 3 '19 at 13:18echo $new_reqs;
tovar_dump($new_reqs);
Then show us the output – RiggsFolly May 3 '19 at 15:18