Make arrays same format?

Discussion in 'PHP' started by Triexa, Nov 10, 2006.

  1. #1
    I really need to stop working at 1am... I used to be good, but now my brain no worky.

    Say I have $var. With a single array element, it would look like

    
    Array {
        Array('Testing', '123');
    }
    
    Code (markup):
    If I have multiple array elements, then it looks like:
    
    Array {
        [0] => Array('Testing', '123');
        [1] = Array('This is', 'another element');
    }
    
    Code (markup):
    Is there some way to automatically put the first one into an array, so its the same, having [0] = array('Testing', '123') ?

    I hope that made perfect sense and I hope the answer is super simple and I just can't think.
     
    Triexa, Nov 10, 2006 IP
  2. Triexa

    Triexa Active Member

    Messages:
    580
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    NEVERMIND.

    Erased everything I had, started from scratch, and did it no problem. haha :)
     
    Triexa, Nov 10, 2006 IP
  3. Nick_Mayhem

    Nick_Mayhem Notable Member

    Messages:
    3,486
    Likes Received:
    338
    Best Answers:
    0
    Trophy Points:
    290
    #3
    
    <?php
    $var[] = "123";
    $var[] = "456";
    $var[] = "abc";
    $var[] = "xyz";
    $var[] = "pqr";
    $var[] = "12.3";
    $var[] = "Everything looks good till now.";
    $var[] = "Okay done";
    ?>
    
    PHP:
    Try this out.
     
    Nick_Mayhem, Nov 10, 2006 IP
  4. thedark

    thedark Well-Known Member

    Messages:
    1,346
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    168
    Digital Goods:
    1
    #4
    next time try to use objects.
     
    thedark, Nov 11, 2006 IP
  5. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The solution to all programming obstacles. ;)

    Don't you find that sometimes they are more than is actually required? Slowing down the design process?
     
    streety, Nov 11, 2006 IP