fork(3) download
  1. <?php
  2.  
  3. function properCase( $string ) {
  4. $ignore = 'de do das da dos';
  5. $string = ucwords( mb_strtolower( $string ) );
  6. return str_replace(explode(' ', ucwords( $ignore)), explode(' ', $ignore), $string);
  7. }
  8.  
  9. echo properCase( 'POUSADA DO BANANAL' );
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Pousada do Bananal