Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

Re: [PHP] Strings and Arrays From: Rasmus Lerdorf (rasmus <email protected>)
Date: 07/13/00

Just loop through it with a for loop.

ie.

$word = "abc";
for($i=0; $i<strlen($word); $i++) {
        echo $word[$i];
}

-Rasmus

On Thu, 13 Jul 2000, Derick Schuetz wrote:

> I read somewhere in the annotated manual that strings are character arrays.
> I am very unfamiliar with the use of arrays in PHP, so I am wondering if
> someone could throw me a quick pointer or two. I want to print a modified
> block of html code for each letter in a string. So if I create a function
> that can be passed the string itself, how would I print out the block of
> code for each individual letter in the array? This is the code I tried to
> use, but it did not work:
>
> function unnamed( $word ) {
> GLOBAL $val;
>
> reset ( $word );
> while (list ($val) = each ($word)) {
> echo "HTML CODE FOR EACH LETTER";
> }
>
> Thanks!
>
> Derick Schuetz
> dschuetz <email protected>
>
>
>
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>