0

I like to show a message on 1 page of my website after login. Therefore I made a rule. To determine the mobile device I use module : mobile_detect. I installed the corresponding library. Checking the status is saying it is available.

They module readme shows the example code:

$detect = mobile_detect_get_object();
$is_mobile = $detect->isMobile();

So when I rewrite this in a message with php eval like this:

#
<?php 
$detect = mobile_detect_get_object();
$is_mobile = $detect->isMobile();
print ($is_mobile);
?>
#

So the result should be : #TRUE# or #FALSE# but I get back # #.

What can I do to solve this?

1 Answer 1

1

According to PHP manual

A boolean TRUE value is converted to the string "1". Boolean FALSE is converted to "" (the empty string). This allows conversion back and forth between boolean and string values.

You can use below code instead

print ($is_mobile ? "TRUE" : "FALSE");
1
  • thxs, it worked
    – Justme
    Commented Jul 12, 2016 at 10:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.