Re: Strings and Arrays

From: Date: Thu, 13 Jul 2000 16:45:11 +0000
Subject: Re: Strings and Arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6492@lists.php.net to get a copy of this message
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@ausam.com > > > > > >

« previous php.general (#6492) next »