Thursday, May 5, 2011

Change Title Case Using String Functions Being Ucwords

| Thursday, May 5, 2011 | 0 comments

there any php functions that are used to convert a string into upper case, lower case or title case. For this time I just want to discuss ucwords function. Ucwords function is a function that is used to change the characters of a string to title case form

Syntax of function ucwords:
$ output = ucwords ($ change);
variable $ output is a place used for storing strings that have been dibuah by ucwords function.
The variable $ change is a string that want dichange into title case.
Source code (save it as ucwords.php):

   1:  <title>ucwords</title>


   2:  <center>


   3:  <form action="ucwords.php" method="get">


   4:    <table width="222" border="0">


   5:      <tr>


   6:        <td width="68">sentence</td>


   7:        <td width="144"><input type="text" name="sentence" value="&lt;?php echo $_GET[sentence]; ?>" /></td>


   8:      </tr>


   9:      <tr>


  10:        <td colspan="2" align="center"><input type="submit" name="submit" value="process" /></td>


  11:        </tr>


  12:    </table>


  13:  </form>


  14:  <?php


  15:  if ($_GET[submit]=="process") {


  16:  ?>


  17:  sentence<b><?php echo $_GET[sentence]; ?></b> after using the function becomes ucwords berchange


  18:  <?php


  19:  $sentence=ucwords($_GET[sentence]);


  20:  echo "&lt;b>$sentence</b>";


  21:  }


  22:  ?>


  23:  </center>
















sentence

<?php
if ($_GET[submit]=="process") {
?>sentence<?php echo $_GET[sentence]; ?> after using the function becomes ucwords berchange
 
The above is a preview, the extension must php

0 comments:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Post a Comment

thank you for visiting my blog and comment here. I hope the commentary contains a comment which intend to build and repair. criticism and suggestions I gladly accept.

Popular Posts

 

Total Pageviews

stat

© Copyright 2010. http://programminghaha.blogspot.com . All rights reserved | http://programminghaha.blogspot.com is proudly powered by Blogger.com | Template by o-om.com - zoomtemplate.com