simple : echo "space.$str"

Discussion in 'PHP' started by mehdiali, Jun 11, 2008.

  1. #1
    Hi folks
    i want to print something like this :
    mehdi
    1space mehdi
    2spaces mehdi
    3spaces mehdi
    ...
    attend to spaces at the beginig of string(mehdi).
    in formal way they appear like:
    mehdi
    mehdi
    mehdi
    mehdi
    ...
    how can i do this ?
    thank you
     
    mehdiali, Jun 11, 2008 IP
  2. mehdiali

    mehdiali Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    thank you all.
    this is solution :
    <?php
    echo '&nbsp;&nbsp;&nbsp;&nbsp;Four spaces';

    echo '<pre> Four spaces</pre>';
    ?>
     
    mehdiali, Jun 11, 2008 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    or use this

    <?php
    str_repeat("&nbsp;", 4) . "Four spaces";
    ?>
     
    EricBruggema, Jun 11, 2008 IP