I have echo $item;
and it puts out a string. the problem is it should check if the string is not longer than 40 characters, and if it is it should cut it at 40 and then replace it with "..."
any tips how to do this?
thanks
<?php if (strlen($item) > 40)) { echo substr($item, 0, 40)."..."; } else { echo $item; } ?>
<?php if (strlen($item) > 40)) { echo substr($item, 0, 37)."..."; } else { echo $item; } ?>
😉