display string variable in web browser ( n characters per line)

Discussion in 'PHP' started by t7584, Feb 20, 2006.

  1. #1
    display string variable in web browser ( n characters per line)
    Is it possible in php to display in web browser string variable with specified number of characters per line.
    For example variable
    s="44444444"
    Is it possible to displays s in web browser with 2 characters per line?
    Like this:
    44
    44
    44
    44
    If you know how to do this, could you give exact code.
     
    t7584, Feb 20, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use http://uk2.php.net/substr to break the string into 2 character sections and then echo each section on a new line.

    Or use a function to insert /n or <BR> every 3rd character.
     
    mad4, Feb 20, 2006 IP
  3. Perrow

    Perrow Well-Known Member

    Messages:
    1,306
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Perrow, Feb 20, 2006 IP