Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: letters to word

  1. #1
    New to the CF scene
    Join Date
    May 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    letters to word

    how can i put letters in a single word in php ???
    exemple:
    for ($i = 0, $j = strlen($string); $i < $j; $i++) {
    $res=$string[$i];
    $res = chr(ord($res)+2);
    echo $res;
    }
    i want to put all the $res in a single word... Any help ?? Thank You

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    create a var, keep adding the letter to it with '.=' (concatenation)
    PHP Code:
    <?php
    $string
    ='wombats rule';
    $out='';
    for (
    $i 0$j strlen($string); $i $j$i++) {
       
    $res=$string[$i];
       
    $res chr(ord($res)+2);
       
    $out .= $res;
    }
    echo 
    $out;
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • Users who have thanked firepages for this post:

    hedded (05-10-2012)

  • #3
    New to the CF scene
    Join Date
    May 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thank you a lot


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •