Sunday, December 4, 2011

String Functions

Code Example


example.html
<html>
    <body>
        <form action="example.php">
            Enter a string <input type="text" name="string" value="" /><br/>
            <input type="submit" value="   Submit    " name="submit"/>
        </form>
    </body>
</html>
example.php
<?php
 if(isset ($_GET['submit'])){
     $string = $_GET['string'];
     //encrypt the string
     echo 'encrypt the string : '.  crypt($string).'<br/>';

     // lenth of th string  
     echo 'lenth of the string : '.  strlen($string).'<br/>';  

     // possition of a string
     echo 'possition of a in string : '.  strpos($string, 'a').'<br/>';

     //capitalize the first character
     echo 'uper case first char : '.  ucfirst($string).'<br/>';
 }
?>

No comments:

Post a Comment