-2

i wants to display this text in a different div if the text character length is grater than 10 chars.

$tasdg = "cars";
if(strlen(($tasdg)>10)) {
    print ' <div style="font-size:22px; font-weight:bold;">'.$tasdg.'</div>';
}else {
    print '<div style="font-size:12px;">'.$tasdg.'</div>';
}
Murad Hasan
  • 9,565
  • 2
  • 21
  • 42
alex
  • 35
  • 8

1 Answers1

1

Try to change your IF statement to look like this:

if(strlen($tasdg)>10) {

You placed the brackets wrong, the result of strlen($tagdg) needs to be more than 10.

fistuks
  • 469
  • 3
  • 5