Mega Code Archive

 
Categories / Php / Functions
 

String Manipulation

<html>    <head>    <title>String Manipulation</title>   </head>  <body>   <form action="strings.php" method="post">   <b>Enter some text here:</b><br>   <textarea name="txt" rows="3" cols="45"></textarea> <br>   <input type="radio" name="fcn" value="strlen">Find the text length   <input type="radio" name="fcn" value="strrev">Reverse the text<br>   <input type="radio" name="fcn" value="strtoupper">Change to all uppercase   <input type="radio" name="fcn" value="strtolower">Change to all lowercase<br>   <input type="radio" name="fcn" value="ucwords">Make the first letter of all words uppercase   <hr>   <input type="submit" value="Manipulate">    </form>  </body> </html> File: strings.php <html>  <head>   <title>String Result</title>  </head>  <body>  <?php   $txt = $_POST['txt'];  $fcn = $_POST['fcn'];  echo( $fcn( $txt ) ); ?>  </body> </html>