Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-10-2012, 12:59 PM   PM User | #1
hedded
New to the CF scene

 
Join Date: May 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
hedded is an unknown quantity at this point
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
hedded is offline   Reply With Quote
Old 05-10-2012, 01:44 PM   PM User | #2
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,890
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
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)
firepages is offline   Reply With Quote
Users who have thanked firepages for this post:
hedded (05-10-2012)
Old 05-10-2012, 05:31 PM   PM User | #3
hedded
New to the CF scene

 
Join Date: May 2012
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
hedded is an unknown quantity at this point
thank you a lot
hedded is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:29 PM.


Advertisement
Log in to turn off these ads.