PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i started getting mixed results. I did get one version working but what i know about loops tells me the code is wrong even though it apears to be working.
Last edited by cybershot on Thu Jul 24, 2008 12:35 pm, edited 1 time in total.
There are a couple of things wrong with that loop.
- You forgot the dollar sign in front of the "I" variable
- The string is only 5 characters long but you iterate up to 10 times, use strlen() to get the length of the string
In php strings can be treated as arrays for this purpose i.e. you can access elements like $hi[1]. However, they are not actually arrays. Usually with arrays a foreach($array as $variable){echo $variable;} type loop is used. This does not work with strings.