Array start at 1?

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

  1. #1
    please delete. got answer
     
    Triexa, Nov 18, 2006 IP
  2. legend2

    legend2 Well-Known Member

    Messages:
    1,537
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    115
    #2
    starting index is 0.
     
    legend2, Nov 19, 2006 IP
  3. skynet102

    skynet102 Peon

    Messages:
    179
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i believe all language array all start at 0. hehe
     
    skynet102, Nov 20, 2006 IP
  4. Triexa

    Triexa Active Member

    Messages:
    580
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    umm vb 6 :)
     
    Triexa, Nov 20, 2006 IP
  5. LouisR

    LouisR Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    For those still interested, I've created my own little simple hack for this:

    
    <?php
    $array1=array("value1", "value2");
    $blank_array=array(null);
    $final_array = array_merge($blank_array,$array1);
    unset($final_array[0]);
    
    print_r($final_array);
    ?>
    
    PHP:
     
    LouisR, Nov 20, 2006 IP
  6. crazybjörn

    crazybjörn Peon

    Messages:
    270
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Why would you need an array to start at key[1] though? Seems like a waste of CPU :p
     
    crazybjörn, Nov 21, 2006 IP
  7. Triexa

    Triexa Active Member

    Messages:
    580
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #7
    Cause I had a bunch of other stuff that, for their own reason, needed to start at 1 and index 0 was ignored.

    This other array that started at 0 though, needed to link to the 1

    Either way, I've got it now.. so all is fine
     
    Triexa, Nov 21, 2006 IP