Displaying digits separately

Discussion in 'PHP' started by Sttg00af, Apr 11, 2008.

  1. #1
    Hello,

    I have a number with 16 digits and a table row with 16 cells. I want each digit to appear in a different cell. Can anyone tell me if there is a way to do this using PHP?

    Thanks
     
    Sttg00af, Apr 11, 2008 IP
  2. stoli

    stoli Peon

    Messages:
    69
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?php
    
    $number = "1234567891234567";
    
    echo "<table><tr>";
    foreach (str_split(strval($number)) as $value) {
      echo "<td>".$value."</td>";
    }
    echo "</tr></table>";
    
    ?>
    PHP:
     
    stoli, Apr 11, 2008 IP
  3. Sttg00af

    Sttg00af Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much.
     
    Sttg00af, Apr 11, 2008 IP