Need to check if $message length is 7 characters or less, if so, do action A, if not, do action B. Is this correct syntax? I think im doing something wrong?
<?php
if (strlen($message) <= 7) {
echo $actiona;
} else {
echo $actionb;
}
?>
It's fine. For example, let's run the following:
<?php
$message = "Hello there!";
if (strlen($message) <= 7){
echo "It is less than or equal to 7 characters.";
}
else
{
echo "It is greater than 7 characters.";
}
?>
It will print: "It is greater than 7 characters."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With