Please help!!

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!

Moderator: General Moderators

Post Reply
edmore
Forum Newbie
Posts: 1
Joined: Mon Mar 30, 2009 5:12 am

Please help!!

Post by edmore »

I have this code in a template that I am customising

Code: Select all

<?php
   $lstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
   for( $i = 0; $i < strlen($lstr); $i++ ) {
   $l = substr( $lstr, $i, 1);
   echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'alpha=' . $l ) . '"><u>' . $l . '</u></a>&nbsp;&nbsp;';
}
?>
As it is, it outputs right across the page. What I really want is to separate the letters on different lines like this:

ABCDE on line 1
FGHIJ on line 2
KLMNO on line 3
PQRSTU on line 4
VWXYZ on line 5

How do I do this

Many Thanks

Eddie
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: Please help!!

Post by php_east »

Code: Select all

   
$word_length=4;
for( $i = 0; $i < strlen($lstr); $i=$i+$word_length ) {
   $l = substr( $lstr, $i, $word_length);
 
and add a <br after your link.
Post Reply