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,545
  • 11
  • 43
  • 77

3 Answers3

9

Should do it. Just wrap it in ucfirst function

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

use ucfirst() and strtolower()

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

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

erdeszt
  • 805
  • 5
  • 12