Payday Loan - Debt Consolidation - Wordpress Theme - Bad Credit Loans - Debt Consolidation

PDA

View Full Version : String


Danago
Dec 6th 2006, 6:06 pm
Hey. Lets say i have a string...$string...

How can i replace each individual letter of $string with the following:

"Letter is [letter]"

where [letter] is the corrosponding letter. I was thinking about putting each letter into an array and using a foreach loop, but i dont know how to split the string up :(

Thanks in advance,
Dan.

klown
Dec 6th 2006, 6:08 pm
a string is automatically a array of letters so you can just do the following..


$string="blah blah";
$x=0;
while ($string[$x]!="")
{
echo "$x: Letter is $string[$x]<br>";
++$x;
}

Danago
Dec 6th 2006, 6:19 pm
Thanks for the help :) Exactly what im looking for :)