1

The following echo is currently all uppercase, how do I force the first letter capitalized and the rest lower case of each word but still limit the length using substr or something similar?

<?php echo substr($row['fulladdress'],0,20); ?>
Rocco The Taco
  • 3,695
  • 13
  • 46
  • 79

3 Answers3

9

Should do it. Just wrap it in ucfirst function

<?php echo ucfirst(strtolower(substr($row['fulladdress'],0,20))); ?>
wesside
  • 5,622
  • 5
  • 30
  • 35
3

use ucfirst() and strtolower()

<?php echo substr(ucfirst(strtolower($row['fulladdress'])),0,20); ?>
Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
2

Like: <?php echo ucfirst(strtolower(substr($row['fulladdress'],0,20))); ?>

erdeszt
  • 799
  • 5
  • 12