Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder Skyzyx's Avatar
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts

    "Compressing" (?) an Array

    I can't remember for the life of me how to do this:

    If you have an array:
    Code:
    bobbo[0]="Alpha";
    bobbo[1]="Bravo";
    bobbo[2]="Charlie";
    etc.
    You can remove one of the values by setting it to null:
    Code:
    bobbo[1]=null;
    Then the array values will return as follows:
    Code:
    bobbo[0]="Alpha";
    bobbo[1]=null;
    bobbo[2]="Charlie";
    etc.
    I know there's a way to "compress" (I don't think it's called that, but I can't think of what it's called...) the array to squeeze out the null values:
    Code:
    bobbo[0]="Alpha";
    bobbo[1]="Charlie";
    etc.
    Does anyone know how to do this? If so, what's it called again?

    Creator of SimplePie and Tarzan AWS, co-founder of WarpShare, co-built the Y! Messenger website, usability-focused, and an INFJ personality.

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •