File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/case.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/case.php  >  Download  
File: fwphp/glomodul/z_examples/book_video/03steinmetz_2008/ch05_txt_html/case.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 2 months ago
Size: 747 bytes
 

Contents

Class file image Download
<?
$string
= "heY hOw arE yoU doinG?";
echo
strtoupper($string);
// Displays "HEY HOW ARE YOU DOING? "

echo strtolower($string);
// displays "hey how are you doing?"

echo ucwords(strtolower($string));
// displays "Hey How Are You Doing?"


print "\n";

function
fussy_capitalize($string) {
   
// uppercases, but leave certain words in lowercase
   
$uppercase_words = array("Of ","A ","The ","And ","An ", "Or ");
   
$lowercase_words = array("of ","a ","the ","and ","an ","or ");

   
$string = ucwords(strtolower($string));
   
$string = str_replace($uppercase_words, $lowercase_words, $string);
   
// uppercase the first word
   
return ucfirst($string);
}

print
fussy_capitalize("the rain in spain falls mostly on the plain\n");

?>

For more information send a message to info at phpclasses dot org.